@@ -391,17 +391,26 @@ AX_CHECK_FETCHER
# Checks for libraries.
AC_CHECK_HEADER([bzlib.h], [
-AC_CHECK_LIB([bz2], [BZ2_bzDecompressInit], [zlib="$zlib -DHAVE_BZLIB -lbz2"])
+ AC_CHECK_LIB([bz2], [BZ2_bzDecompressInit],
+ [ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_BZLIB"
+ ZLIB_LIBS="$ZLIB_LIBS -lbz2"])
])
AC_CHECK_HEADER([lzma.h], [
-AC_CHECK_LIB([lzma], [lzma_stream_decoder], [zlib="$zlib -DHAVE_LZMA -llzma"])
+ AC_CHECK_LIB([lzma], [lzma_stream_decoder],
+ [ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_LZMA"
+ ZLIB_LIBS="$ZLIB_LIBS -llzma"])
])
AC_CHECK_HEADER([lzo/lzo1x.h], [
-AC_CHECK_LIB([lzo2], [lzo1x_decompress], [zlib="$zlib -DHAVE_LZO1X -llzo2"])
+ AC_CHECK_LIB([lzo2], [lzo1x_decompress],
+ [ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_LZO1X"
+ ZLIB_LIBS="$ZLIB_LIBS -llzo2"])
])
PKG_CHECK_MODULES([libzstd], [libzstd],
- [zlib="$zlib -DHAVE_ZSTD $libzstd_CFLAGS $libzstd_LIBS"], [true])
-AC_SUBST(zlib)
+ [ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_ZSTD $libzstd_CFLAGS"
+ ZLIB_LIBS="$ZLIB_LIBS $libzstd_LIBS"],
+ [true])
+AC_SUBST([ZLIB_CFLAGS])
+AC_SUBST([ZLIB_LIBS])
AX_CHECK_EXTFS
AX_CHECK_PTHREAD
AX_CHECK_PTYFUNCS
@@ -66,7 +66,8 @@ CONFIG_9PFS := @ninepfs@
LINUX_BACKEND_MODULES := @LINUX_BACKEND_MODULES@
#System options
-ZLIB := @zlib@
+ZLIB_CFLAGS := @ZLIB_CFLAGS@
+ZLIB_LIBS := @ZLIB_LIBS@
CONFIG_LIBICONV := @libiconv@
EXTFS_LIBS := @EXTFS_LIBS@
CURSES_LIBS := @CURSES_LIBS@
@@ -641,7 +641,8 @@ PTHREAD_LIBS
PTHREAD_LDFLAGS
PTHREAD_CFLAGS
EXTFS_LIBS
-zlib
+ZLIB_LIBS
+ZLIB_CFLAGS
libzstd_LIBS
libzstd_CFLAGS
FETCHER
@@ -8605,7 +8606,7 @@ fi
ac_fn_c_check_header_mongrel "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default"
if test "x$ac_cv_header_bzlib_h" = xyes; then :
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzDecompressInit in -lbz2" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzDecompressInit in -lbz2" >&5
$as_echo_n "checking for BZ2_bzDecompressInit in -lbz2... " >&6; }
if ${ac_cv_lib_bz2_BZ2_bzDecompressInit+:} false; then :
$as_echo_n "(cached) " >&6
@@ -8642,7 +8643,8 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bz2_BZ2_bzDecompressInit" >&5
$as_echo "$ac_cv_lib_bz2_BZ2_bzDecompressInit" >&6; }
if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes; then :
- zlib="$zlib -DHAVE_BZLIB -lbz2"
+ ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_BZLIB"
+ ZLIB_LIBS="$ZLIB_LIBS -lbz2"
fi
@@ -8652,7 +8654,7 @@ fi
ac_fn_c_check_header_mongrel "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default"
if test "x$ac_cv_header_lzma_h" = xyes; then :
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzma_stream_decoder in -llzma" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzma_stream_decoder in -llzma" >&5
$as_echo_n "checking for lzma_stream_decoder in -llzma... " >&6; }
if ${ac_cv_lib_lzma_lzma_stream_decoder+:} false; then :
$as_echo_n "(cached) " >&6
@@ -8689,7 +8691,8 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lzma_lzma_stream_decoder" >&5
$as_echo "$ac_cv_lib_lzma_lzma_stream_decoder" >&6; }
if test "x$ac_cv_lib_lzma_lzma_stream_decoder" = xyes; then :
- zlib="$zlib -DHAVE_LZMA -llzma"
+ ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_LZMA"
+ ZLIB_LIBS="$ZLIB_LIBS -llzma"
fi
@@ -8699,7 +8702,7 @@ fi
ac_fn_c_check_header_mongrel "$LINENO" "lzo/lzo1x.h" "ac_cv_header_lzo_lzo1x_h" "$ac_includes_default"
if test "x$ac_cv_header_lzo_lzo1x_h" = xyes; then :
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzo1x_decompress in -llzo2" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzo1x_decompress in -llzo2" >&5
$as_echo_n "checking for lzo1x_decompress in -llzo2... " >&6; }
if ${ac_cv_lib_lzo2_lzo1x_decompress+:} false; then :
$as_echo_n "(cached) " >&6
@@ -8736,7 +8739,8 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lzo2_lzo1x_decompress" >&5
$as_echo "$ac_cv_lib_lzo2_lzo1x_decompress" >&6; }
if test "x$ac_cv_lib_lzo2_lzo1x_decompress" = xyes; then :
- zlib="$zlib -DHAVE_LZO1X -llzo2"
+ ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_LZO1X"
+ ZLIB_LIBS="$ZLIB_LIBS -llzo2"
fi
@@ -8812,10 +8816,12 @@ else
libzstd_LIBS=$pkg_cv_libzstd_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- zlib="$zlib -DHAVE_ZSTD $libzstd_CFLAGS $libzstd_LIBS"
+ ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_ZSTD $libzstd_CFLAGS"
+ ZLIB_LIBS="$ZLIB_LIBS $libzstd_LIBS"
fi
+
ac_fn_c_check_header_mongrel "$LINENO" "ext2fs/ext2fs.h" "ac_cv_header_ext2fs_ext2fs_h" "$ac_includes_default"
if test "x$ac_cv_header_ext2fs_ext2fs_h" = xyes; then :
@@ -89,13 +89,12 @@ CFLAGS += $(CFLAGS_libxendevicemodel)
CFLAGS += $(CFLAGS_libxencall) $(CFLAGS_libxenforeignmemory)
ifeq ($(CONFIG_MiniOS),y)
-zlib-options =
-else
-zlib-options = $(ZLIB)
+ZLIB_CFLAGS :=
+ZLIB_LIBS :=
endif
-xg_dom_bzimageloader.o: CFLAGS += $(filter -D%,$(zlib-options))
-xg_dom_bzimageloader.opic: CFLAGS += $(filter -D%,$(zlib-options))
+xg_dom_bzimageloader.o: CFLAGS += $(ZLIB_CFLAGS)
+xg_dom_bzimageloader.opic: CFLAGS += $(ZLIB_CFLAGS)
LIBHEADER := xenguest.h
@@ -103,8 +102,7 @@ NO_HEADERS_CHK := y
include $(XEN_ROOT)/tools/libs/libs.mk
-libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(filter -l%,$(zlib-options))
-libxenguest.so.$(MAJOR).$(MINOR): APPEND_LDFLAGS += $(COMPRESSION_LIBS) -lz
+libxenguest.so.$(MAJOR).$(MINOR): APPEND_LDFLAGS += $(ZLIB_LIBS) -lz
-include $(DEPS_INCLUDE)
Use both ZLIB_CFLAGS and ZLIB_LIBS instead of cherry-picking flags from a single "ZLIB" variable. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- tools/configure.ac | 19 ++++++++++++++----- config/Tools.mk.in | 3 ++- tools/configure | 22 ++++++++++++++-------- tools/libs/guest/Makefile | 12 +++++------- 4 files changed, 35 insertions(+), 21 deletions(-)