[RFA] Add --with-libz-prefix option in config/zlib.m4
Joel Brobecker
brobecker@adacore.com
Wed Jan 7 14:46:00 GMT 2015
Hello,
This patch enhances config/zlib.m4 to introduce an extra option
--with-libz-prefix which allows us to provide the location of
the zlib library we want to use during the build.
config/ChangeLog:
* zlib.m4 (AM_ZLIB): Add --with-libz-prefix option support.
I didn't see any file in the GCC project that uses this macro,
so for the GCC repository, the change to zlib.m4 is it. But
I am also attaching to this email a copy of the patch that
will be applied to the binutils-gdb.git repository, with all
configury using this macro being re-generated - mostly for info,
also as a heads-up to both binutils and GDB.
This was tested by regenerating all autoconf/automake files in
the binutils-gdb project, and rebuilding GDB, using the following
combinations:
--with-zlib (system zlib used)
--with-libz-prefix=/zlib/prefix (specific zlib linked in)
--with-zlib --with-libz-prefix=/zlib/prefix (specific zlib linked in)
--without-zlib (zlib support turned off)
--without-zlib --with-zlib-prefix (zlib support turned off)
--with-zlib (no system zlib available, configure fails with expected error)
--with-zlib --with-libz-prefix=/invalid/zlib/prefix
(no system zlib, configure fails with same error)
OK to commit?
Thank you!
--
Joel
---
config/zlib.m4 | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/config/zlib.m4 b/config/zlib.m4
index b017499..1581124 100644
--- a/config/zlib.m4
+++ b/config/zlib.m4
@@ -9,8 +9,15 @@ AC_DEFUN([AM_ZLIB],
[], [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_LIB_HAVE_LINKFLAGS([z], [], [#include "zlib.h";],
+ [int ret = deflateInit(NULL, 1);])
+ if test "$HAVE_LIBZ" = "yes"; then
+ # Make sure HAVE_ZLIB_H gets defined. Some code uses that over
+ # HAVE_LIBZ, since initially we were only defining HAVE_ZLIB_H.
+ AC_CHECK_HEADERS(zlib.h)
+ LIBS="$LIBS $LIBZ"
+ fi
+ if test "$with_zlib" = "yes" -a "$HAVE_LIBZ" != "yes"; then
AC_MSG_ERROR([zlib (libz) library was explicitly requested but not found])
fi
fi
--
1.9.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-config-zlib.m4-Add-support-for-with-libz-prefix.patch
Type: text/x-diff
Size: 228945 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150107/249e9aec/attachment.bin>
More information about the Gcc-patches
mailing list