1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

build-sys: enable lz4 by default if available

--enable-lz4 can be used to force lz4 requirement,
--disable-lz4 can be used to skip lz4 support even if available.

Also, make surrounding checks for bzip2, xz, and zlib similar in structure.
This fixes the check for requested but missing bzip2.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2015-10-14 22:57:55 -04:00
parent 5146f9f065
commit 1a2a0ac53b

View File

@ -520,25 +520,27 @@ AC_SUBST(CERTIFICATEROOT)
# ------------------------------------------------------------------------------
have_xz=no
AC_ARG_ENABLE(xz, AS_HELP_STRING([--disable-xz], [Disable optional XZ support]))
if test "x$enable_xz" != "xno"; then
AS_IF([test "x$enable_xz" != "xno"], [
PKG_CHECK_MODULES(XZ, [ liblzma ],
[AC_DEFINE(HAVE_XZ, 1, [Define if XZ is available]) have_xz=yes], have_xz=no)
if test "x$have_xz" = xno -a "x$enable_xz" = xyes; then
AC_MSG_ERROR([*** XZ support requested but libraries not found])
fi
fi
[AC_DEFINE(HAVE_XZ, 1, [Define if XZ is available])
have_xz=yes],
have_xz=no)
AS_IF([test "x$have_xz" = xno -a "x$enable_xz" = xyes],
[AC_MSG_ERROR([*** XZ support requested but libraries not found])])
])
AM_CONDITIONAL(HAVE_XZ, [test "$have_xz" = "yes"])
# ------------------------------------------------------------------------------
have_zlib=no
AC_ARG_ENABLE(zlib, AS_HELP_STRING([--disable-zlib], [Disable optional ZLIB support]))
if test "x$enable_zlib" != "xno"; then
AS_IF([test "x$enable_zlib" != "xno"], [
PKG_CHECK_MODULES(ZLIB, [ zlib ],
[AC_DEFINE(HAVE_ZLIB, 1, [Define if ZLIB is available]) have_zlib=yes], have_zlib=no)
if test "x$have_zlib" = xno -a "x$enable_zlib" = xyes; then
AC_MSG_ERROR([*** ZLIB support requested but libraries not found])
fi
fi
[AC_DEFINE(HAVE_ZLIB, 1, [Define if ZLIB is available])
have_zlib=yes],
have_zlib=no)
AS_IF([test "x$have_zlib" = xno -a "x$enable_zlib" = xyes],
[AC_MSG_ERROR([*** ZLIB support requested but libraries not found])])
])
AM_CONDITIONAL(HAVE_ZLIB, [test "$have_zlib" = "yes"])
# ------------------------------------------------------------------------------
@ -546,20 +548,24 @@ have_bzip2=no
AC_ARG_ENABLE(bzip2, AS_HELP_STRING([--enable-bzip2], [Disable optional BZIP2 support]))
AS_IF([test "x$enable_bzip2" != "xno"], [
AC_CHECK_HEADERS(bzlib.h,
[AC_DEFINE(HAVE_BZIP2, 1, [Define in BZIP2 is available])
[AC_DEFINE(HAVE_BZIP2, 1, [Define if BZIP2 is available])
have_bzip2=yes],
[AS_IF([test "x$have_bzip2" = xyes], [AC_MSG_ERROR([*** BZIP2 support requested but headers not found])])
])
[AS_IF([test "x$enable_bzip2" = xyes],
[AC_MSG_ERROR([*** BZIP2 support requested but headers not found])])]
)
])
AM_CONDITIONAL(HAVE_BZIP2, [test "$have_bzip2" = "yes"])
# ------------------------------------------------------------------------------
have_lz4=no
AC_ARG_ENABLE(lz4, AS_HELP_STRING([--enable-lz4], [Enable optional LZ4 support]))
AS_IF([test "x$enable_lz4" = "xyes"], [
AC_ARG_ENABLE(lz4, AS_HELP_STRING([--disable-lz4], [Disable optional LZ4 support]))
AS_IF([test "x$enable_lz4" != "xno"], [
PKG_CHECK_MODULES(LZ4, [ liblz4 >= 125 ],
[AC_DEFINE(HAVE_LZ4, 1, [Define in LZ4 is available]) have_lz4=yes],
[AC_MSG_ERROR([*** LZ4 support requested but libraries not found])])
[AC_DEFINE(HAVE_LZ4, 1, [Define in LZ4 is available])
have_lz4=yes],
have_lz4=no)
AS_IF([test "x$have_lz4" = xno -a "x$enable_lz4" = xyes],
[AC_MSG_ERROR([*** LZ4 support requested but libraries not found])])
])
AM_CONDITIONAL(HAVE_LZ4, [test "$have_lz4" = "yes"])