This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Add support for --disable-zlib


Hello,

We'd like to be able to distribute binutils and GDB without an extra
dependency on zlib, so we're introducing a new configure switch
--disable-zlib.  The current behavior remains the default.

Since zlib is checked a 4 different locations exactly the same way,
we introduced a new file config/zlib.m4, which is then included by
the various configure scripts.  This file provides an AM_ZLIB function
that checks whether --disable-zlib, and if now, then checks for zlib
support.

config/

        * zlib.m4: New file.

bfd/

        * acinclude.m4: Add include of ../config/zlib.m4.
        * configure.in: AM_ZLIB to check for zlib support.
        * configure: Regenerate.

Tested on x86_64-linux by building GDB with and without --disable-zlib.
I could verify that the dependency on libz disappeared in the second
case.  (there will be a corresponding change for gdb and sim posted
there).

OK to commit? (I know that config/zlib.m4 will then need to be
checked in the GCC SVN as well).

Thanks,
-- 
Joel
commit 0e8fdd9f03a8fc2fdd621775c95a5cfc263a65a2
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Fri Oct 30 10:15:09 2009 -0700

        * zlib.m4: New file.

diff --git a/config/zlib.m4 b/config/zlib.m4
new file mode 100644
index 0000000..2298277
--- /dev/null
+++ b/config/zlib.m4
@@ -0,0 +1,14 @@
+dnl A function to check for zlib availability.  zlib is used by default
+dnl unless the user configured with --disable-nls.
+
+AC_DEFUN([AM_ZLIB],
+[
+  # See if the user asked for zlib support to be disabled.
+  AC_ARG_ENABLE(zlib,
+    [  --disable-zlib          disable zlib support],
+    try_zlib=$enableval, try_zlib=yes)
+  # If not disabled, then check for zlib availability.
+  if test "$try_zlib" = "yes"; then
+    AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
+  fi
+])
commit 1f06d09d0d318c641bd14cc90364b5a9db4baf9f
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Fri Oct 30 10:15:44 2009 -0700

        * acinclude.m4: Add include of ../config/zlib.m4.
        * configure.in: AM_ZLIB to check for zlib support.
        * configure: Regenerate.

diff --git a/bfd/acinclude.m4 b/bfd/acinclude.m4
index aaa147e..d9813bd 100644
--- a/bfd/acinclude.m4
+++ b/bfd/acinclude.m4
@@ -1,3 +1,5 @@
+sinclude([../config/zlib.m4])
+
 dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
 AC_DEFUN([BFD_BINARY_FOPEN],
 [AC_REQUIRE([AC_CANONICAL_TARGET])
diff --git a/bfd/configure b/bfd/configure
index d5aec74..34ae871 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -934,6 +934,7 @@ enable_build_warnings
 enable_maintainer_mode
 enable_install_libbfd
 enable_nls
+enable_zlib
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1581,6 +1582,7 @@ Optional Features:
 			  (and sometimes confusing) to the casual installer
   --enable-install-libbfd controls installation of libbfd and related headers
   --disable-nls           do not use Native Language Support
+  --disable-zlib          disable zlib support
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -5982,13 +5984,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:5985: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:5987: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:5988: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:5990: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:5991: output\"" >&5)
+  (eval echo "\"\$as_me:5993: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -7193,7 +7195,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 7196 "configure"' > conftest.$ac_ext
+  echo '#line 7198 "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -8424,11 +8426,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8427: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8429: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:8431: \$? = $ac_status" >&5
+   echo "$as_me:8433: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -8763,11 +8765,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8766: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8768: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:8770: \$? = $ac_status" >&5
+   echo "$as_me:8772: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -8868,11 +8870,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8871: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8873: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8875: \$? = $ac_status" >&5
+   echo "$as_me:8877: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -8923,11 +8925,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8926: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8928: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8930: \$? = $ac_status" >&5
+   echo "$as_me:8932: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -11305,7 +11307,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11308 "configure"
+#line 11310 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11401,7 +11403,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11404 "configure"
+#line 11406 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13585,7 +13587,20 @@ _ACEOF
 
 # Link in zlib if we can.  This allows us to read compressed debug sections.
 # This is used only by compress.c.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing zlibVersion" >&5
+
+  # See if the user asked for zlib support to be disabled.
+  # Check whether --enable-zlib was given.
+if test "${enable_zlib+set}" = set; then :
+  enableval=$enable_zlib; try_zlib=$enableval
+else
+  try_zlib=yes
+fi
+
+  # If not disabled, then check for zlib availability.
+  if test "$try_zlib" = "yes"; then
+    # Link in zlib if we can.  This allows us to read compressed debug sections.
+    # This is used only by compress.c.
+    { $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 :
   $as_echo_n "(cached) " >&6
@@ -13652,6 +13667,8 @@ done
 
 fi
 
+  fi
+
 
 # If we are configured native, pick a core file support file.
 COREFILE=
diff --git a/bfd/configure.in b/bfd/configure.in
index 7ca59b0..804a4d5 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -225,7 +225,7 @@ AC_CHECK_DECLS(vsnprintf)
 
 # Link in zlib if we can.  This allows us to read compressed debug sections.
 # This is used only by compress.c.
-AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
+AM_ZLIB
 
 # If we are configured native, pick a core file support file.
 COREFILE=

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]