[RFA] Add support for --without-zlib (was --disable-zlib)

Jan Kratochvil jan.kratochvil@redhat.com
Fri Oct 30 21:22:00 GMT 2009


On Fri, 30 Oct 2009 19:21:57 +0100, Joel Brobecker wrote:
> 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.

It should be more systematic to use AC_ARG_WITH than AC_ARG_ENABLE as it is
about a dependency on external software as described in the autoconf manual.

And I would prefer to be also able to force the requirement - it makes the
vendor packaging sanity checking of prerequisited packages easier.

Tested only separately, outside of the sourceware tree (there should be no
change I hope as externally is visible only the AC_CHECK_HEADERS result).


Thanks,
Jan


config/
	* zlib.m4: New file.

--- /dev/null
+++ b/config/zlib.m4
@@ -0,0 +1,17 @@
+dnl A function to check for zlib availability.  zlib is used by default
+dnl unless the user configured using --without-nls.
+
+AC_DEFUN([AM_ZLIB],
+[
+  # See if the user asked for zlib support to be disabled.
+  AC_ARG_WITH(zlib,
+    [  --with-zlib             include zlib support (auto/yes/no)],
+    [], [with_zlib=auto])
+
+  if test "$with_zlib" != "no"; then
+    AC_SEARCH_LIBS(zlibVersion, 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
+  fi
+])



More information about the Binutils mailing list