diff mbox

Correct zlib checks [Was: binutils prerequisites (recent zlib version - what else?)]

Message ID alpine.LFD.2.00.1108042118220.29709@eddie.linux-mips.org
State New
Headers show

Commit Message

Maciej W. Rozycki Aug. 4, 2011, 10:07 p.m. UTC
On Wed, 20 Apr 2011, Steffen Dettmer wrote:

> I'm trying to build gcc-4.6.0 with binutils-2.21 in the same
> source directory which fails with
> 
> cc1: warnings being treated as errors
> ../../../gcc-4.6.0/binutils/bfd/compress.c: In function
> `bfd_compress_section_contents':
> ../../../gcc-4.6.0/binutils/bfd/compress.c:100: warning: implicit
> declaration of function `compressBound'
> make[7]: *** [compress.lo] Error 1
> 
> (I guess without -Werror it won't link).
> Google told that this is a zlib symbol and my zlib would be too
> old. Do I need more libraries and stuff?

 Hmm, old topic...

 It looks to me we should be checking for this symbol then, rather than 
meaningless for us zlibVersion.  I have updated comments respectively, 
particularly for objdump.c that still needs to link against -lz if libz is 
a static archive.  Any comments about this patch?

 No change for gold/ required as it doesn't use BFD.  Not sure why 
binutils/ and ld/ use their own checks instead of AM_ZLIB, but there you 
go.

2011-08-04  Maciej W. Rozycki  <macro@linux-mips.org>

	config/
	* zlib.m4 (AM_ZLIB): Check for compressBound instead of 
	zlibVersion.

2011-08-04  Maciej W. Rozycki  <macro@linux-mips.org>

	bfd/
	* configure: Regenerate.

2011-08-04  Maciej W. Rozycki  <macro@linux-mips.org>

	binutils/
	* configure.in: Check for compressBound instead of zlibVersion.
	* configure: Regenerate.

2011-08-04  Maciej W. Rozycki  <macro@linux-mips.org>

	gas/
	* configure: Regenerate.

2011-08-04  Maciej W. Rozycki  <macro@linux-mips.org>

	ld/
	* configure.in: Check for compressBound instead of zlibVersion.
	* configure: Regenerate.

  Maciej

binutils-zlib-check.patch

Comments

Paolo Bonzini Aug. 5, 2011, 7:51 a.m. UTC | #1
On 08/05/2011 12:07 AM, Maciej W. Rozycki wrote:
> 2011-08-04  Maciej W. Rozycki<macro@linux-mips.org>
>
> 	config/
> 	* zlib.m4 (AM_ZLIB): Check for compressBound instead of
> 	zlibVersion.

Ok.

Paolo
diff mbox

Patch

Index: bfd/configure
===================================================================
RCS file: /cvs/src/src/bfd/configure,v
retrieving revision 1.353
diff -u -p -r1.353 configure
--- bfd/configure	28 Jul 2011 22:35:13 -0000	1.353
+++ bfd/configure	4 Aug 2011 21:54:36 -0000
@@ -13743,9 +13743,10 @@  fi
 
 
   if test "$with_zlib" != "no"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing zlibVersion" >&5
-$as_echo_n "checking for library containing zlibVersion... " >&6; }
-if test "${ac_cv_search_zlibVersion+set}" = set; then :
+    # BFD needs compressBound that is not present in older versions of zlib.
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing compressBound" >&5
+$as_echo_n "checking for library containing compressBound... " >&6; }
+if test "${ac_cv_search_compressBound+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
@@ -13758,11 +13759,11 @@  cat confdefs.h - <<_ACEOF >conftest.$ac_
 #ifdef __cplusplus
 extern "C"
 #endif
-char zlibVersion ();
+char compressBound ();
 int
 main ()
 {
-return zlibVersion ();
+return compressBound ();
   ;
   return 0;
 }
@@ -13775,25 +13776,25 @@  for ac_lib in '' z; do
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
   fi
   if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_zlibVersion=$ac_res
+  ac_cv_search_compressBound=$ac_res
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext
-  if test "${ac_cv_search_zlibVersion+set}" = set; then :
+  if test "${ac_cv_search_compressBound+set}" = set; then :
   break
 fi
 done
-if test "${ac_cv_search_zlibVersion+set}" = set; then :
+if test "${ac_cv_search_compressBound+set}" = set; then :
 
 else
-  ac_cv_search_zlibVersion=no
+  ac_cv_search_compressBound=no
 fi
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_zlibVersion" >&5
-$as_echo "$ac_cv_search_zlibVersion" >&6; }
-ac_res=$ac_cv_search_zlibVersion
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_compressBound" >&5
+$as_echo "$ac_cv_search_compressBound" >&6; }
+ac_res=$ac_cv_search_compressBound
 if test "$ac_res" != no; then :
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
   for ac_header in zlib.h
Index: binutils/configure
===================================================================
RCS file: /cvs/src/src/binutils/configure,v
retrieving revision 1.139
diff -u -p -r1.139 configure
--- binutils/configure	31 May 2011 08:54:47 -0000	1.139
+++ binutils/configure	4 Aug 2011 21:54:49 -0000
@@ -12970,11 +12970,12 @@  _ACEOF
 
 
 # Link in zlib if we can.  This allows us to read compressed debug
-# sections.  This is used only by readelf.c (objdump uses bfd for
-# reading compressed sections).
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing zlibVersion" >&5
-$as_echo_n "checking for library containing zlibVersion... " >&6; }
-if test "${ac_cv_search_zlibVersion+set}" = set; then :
+# sections.  This is used explicitly by readelf.c, and implicitly
+# by objdump.c which uses bfd (that requires compressBound) for
+# reading compressed sections.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing compressBound" >&5
+$as_echo_n "checking for library containing compressBound... " >&6; }
+if test "${ac_cv_search_compressBound+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
@@ -12987,11 +12988,11 @@  cat confdefs.h - <<_ACEOF >conftest.$ac_
 #ifdef __cplusplus
 extern "C"
 #endif
-char zlibVersion ();
+char compressBound ();
 int
 main ()
 {
-return zlibVersion ();
+return compressBound ();
   ;
   return 0;
 }
@@ -13004,25 +13005,25 @@  for ac_lib in '' z; do
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
   fi
   if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_zlibVersion=$ac_res
+  ac_cv_search_compressBound=$ac_res
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext
-  if test "${ac_cv_search_zlibVersion+set}" = set; then :
+  if test "${ac_cv_search_compressBound+set}" = set; then :
   break
 fi
 done
-if test "${ac_cv_search_zlibVersion+set}" = set; then :
+if test "${ac_cv_search_compressBound+set}" = set; then :
 
 else
-  ac_cv_search_zlibVersion=no
+  ac_cv_search_compressBound=no
 fi
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_zlibVersion" >&5
-$as_echo "$ac_cv_search_zlibVersion" >&6; }
-ac_res=$ac_cv_search_zlibVersion
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_compressBound" >&5
+$as_echo "$ac_cv_search_compressBound" >&6; }
+ac_res=$ac_cv_search_compressBound
 if test "$ac_res" != no; then :
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
   for ac_header in zlib.h
Index: binutils/configure.in
===================================================================
RCS file: /cvs/src/src/binutils/configure.in,v
retrieving revision 1.103
diff -u -p -r1.103 configure.in
--- binutils/configure.in	31 May 2011 08:54:46 -0000	1.103
+++ binutils/configure.in	4 Aug 2011 21:54:49 -0000
@@ -141,9 +141,10 @@  AC_CHECK_DECLS([fprintf, stpcpy, strstr,
 		snprintf, vsnprintf])
 
 # Link in zlib if we can.  This allows us to read compressed debug
-# sections.  This is used only by readelf.c (objdump uses bfd for
-# reading compressed sections).
-AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
+# sections.  This is used explicitly by readelf.c, and implicitly
+# by objdump.c which uses bfd (that requires compressBound) for
+# reading compressed sections.
+AC_SEARCH_LIBS(compressBound, z, [AC_CHECK_HEADERS(zlib.h)])
 
 BFD_BINARY_FOPEN
 
Index: config/zlib.m4
===================================================================
RCS file: /cvs/src/src/config/zlib.m4,v
retrieving revision 1.1
diff -u -p -r1.1 zlib.m4
--- config/zlib.m4	24 Nov 2009 22:35:29 -0000	1.1
+++ config/zlib.m4	4 Aug 2011 21:54:50 -0000
@@ -9,7 +9,8 @@  AC_DEFUN([AM_ZLIB],
     [], [with_zlib=auto])
 
   if test "$with_zlib" != "no"; then
-    AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
+    # BFD needs compressBound that is not present in older versions of zlib.
+    AC_SEARCH_LIBS(compressBound, z, [AC_CHECK_HEADERS(zlib.h)])
     if test "$with_zlib" = "yes" -a "$ac_cv_header_zlib_h" != "yes"; then
       AC_MSG_ERROR([zlib (libz) library was explicitly requested but not found])
     fi
Index: gas/configure
===================================================================
RCS file: /cvs/src/src/gas/configure,v
retrieving revision 1.262
diff -u -p -r1.262 configure
--- gas/configure	18 May 2011 09:41:14 -0000	1.262
+++ gas/configure	4 Aug 2011 21:55:06 -0000
@@ -13997,9 +13997,10 @@  fi
 
 
   if test "$with_zlib" != "no"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing zlibVersion" >&5
-$as_echo_n "checking for library containing zlibVersion... " >&6; }
-if test "${ac_cv_search_zlibVersion+set}" = set; then :
+    # BFD needs compressBound that is not present in older versions of zlib.
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing compressBound" >&5
+$as_echo_n "checking for library containing compressBound... " >&6; }
+if test "${ac_cv_search_compressBound+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
@@ -14012,11 +14013,11 @@  cat confdefs.h - <<_ACEOF >conftest.$ac_
 #ifdef __cplusplus
 extern "C"
 #endif
-char zlibVersion ();
+char compressBound ();
 int
 main ()
 {
-return zlibVersion ();
+return compressBound ();
   ;
   return 0;
 }
@@ -14029,25 +14030,25 @@  for ac_lib in '' z; do
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
   fi
   if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_zlibVersion=$ac_res
+  ac_cv_search_compressBound=$ac_res
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext
-  if test "${ac_cv_search_zlibVersion+set}" = set; then :
+  if test "${ac_cv_search_compressBound+set}" = set; then :
   break
 fi
 done
-if test "${ac_cv_search_zlibVersion+set}" = set; then :
+if test "${ac_cv_search_compressBound+set}" = set; then :
 
 else
-  ac_cv_search_zlibVersion=no
+  ac_cv_search_compressBound=no
 fi
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_zlibVersion" >&5
-$as_echo "$ac_cv_search_zlibVersion" >&6; }
-ac_res=$ac_cv_search_zlibVersion
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_compressBound" >&5
+$as_echo "$ac_cv_search_compressBound" >&6; }
+ac_res=$ac_cv_search_compressBound
 if test "$ac_res" != no; then :
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
   for ac_header in zlib.h
Index: ld/configure
===================================================================
RCS file: /cvs/src/src/ld/configure,v
retrieving revision 1.114
diff -u -p -r1.114 configure
--- ld/configure	28 Mar 2011 10:27:07 -0000	1.114
+++ ld/configure	4 Aug 2011 21:55:31 -0000
@@ -16616,10 +16616,11 @@  _ACEOF
 
 
 # Link in zlib if we can.  This is needed only for the bootstrap tests
-# right now, since those tests use libbfd, which depends on zlib.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing zlibVersion" >&5
-$as_echo_n "checking for library containing zlibVersion... " >&6; }
-if test "${ac_cv_search_zlibVersion+set}" = set; then :
+# right now, since those tests use libbfd, which depends on zlib (and
+# requires compressBound).
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing compressBound" >&5
+$as_echo_n "checking for library containing compressBound... " >&6; }
+if test "${ac_cv_search_compressBound+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
@@ -16632,11 +16633,11 @@  cat confdefs.h - <<_ACEOF >conftest.$ac_
 #ifdef __cplusplus
 extern "C"
 #endif
-char zlibVersion ();
+char compressBound ();
 int
 main ()
 {
-return zlibVersion ();
+return compressBound ();
   ;
   return 0;
 }
@@ -16649,25 +16650,25 @@  for ac_lib in '' z; do
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
   fi
   if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_zlibVersion=$ac_res
+  ac_cv_search_compressBound=$ac_res
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext
-  if test "${ac_cv_search_zlibVersion+set}" = set; then :
+  if test "${ac_cv_search_compressBound+set}" = set; then :
   break
 fi
 done
-if test "${ac_cv_search_zlibVersion+set}" = set; then :
+if test "${ac_cv_search_compressBound+set}" = set; then :
 
 else
-  ac_cv_search_zlibVersion=no
+  ac_cv_search_compressBound=no
 fi
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_zlibVersion" >&5
-$as_echo "$ac_cv_search_zlibVersion" >&6; }
-ac_res=$ac_cv_search_zlibVersion
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_compressBound" >&5
+$as_echo "$ac_cv_search_compressBound" >&6; }
+ac_res=$ac_cv_search_compressBound
 if test "$ac_res" != no; then :
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
   for ac_header in zlib.h
Index: ld/configure.in
===================================================================
RCS file: /cvs/src/src/ld/configure.in,v
retrieving revision 1.69
diff -u -p -r1.69 configure.in
--- ld/configure.in	28 Mar 2011 10:27:07 -0000	1.69
+++ ld/configure.in	4 Aug 2011 21:55:31 -0000
@@ -216,8 +216,9 @@  BFD_BINARY_FOPEN
 AC_CHECK_DECLS([strstr, free, sbrk, getenv, environ])
 
 # Link in zlib if we can.  This is needed only for the bootstrap tests
-# right now, since those tests use libbfd, which depends on zlib.
-AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
+# right now, since those tests use libbfd, which depends on zlib (and
+# requires compressBound).
+AC_SEARCH_LIBS(compressBound, z, [AC_CHECK_HEADERS(zlib.h)])
 
 # When converting linker scripts into strings for use in emulation
 # files, use astring.sed if the compiler supports ANSI string