diff options
author | Gao Xiang <hsiangkao@aol.com> | 2019-11-14 21:41:29 +0800 |
---|---|---|
committer | Gao Xiang <hsiangkao@aol.com> | 2019-11-16 23:25:36 +0800 |
commit | dd37a983616706414e2e4232e2aa96b56a09fed6 (patch) | |
tree | e58726ca2af7dc7f9c3ab0b1b64e4eabd7916966 | |
parent | 203fb2925f99f613583bf7b06a7c9397280e4da8 (diff) |
erofs-utils: set up all compiler/linker variables independently
Otherwise, the following checking will be effected
and it can cause unexpected behavior on configuring.
Founded by the upcoming XZ algorithm patches.
Link: https://lore.kernel.org/r/20191114134521.12416-1-hsiangkao@aol.com
Reviewed-and-tested-by: Li Guifu <blucerlee@gmail.com>
Signed-off-by: Gao Xiang <hsiangkao@aol.com>
-rw-r--r-- | configure.ac | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac index c7dbe0e..f925358 100644 --- a/configure.ac +++ b/configure.ac @@ -168,7 +168,7 @@ if test "x$enable_lz4" = "xyes"; then test -z "${with_lz4_libdir}" || LZ4_LIBS="-L$with_lz4_libdir $LZ4_LIBS" saved_CPPFLAGS=${CPPFLAGS} - CPPFLAGS="${LZ4_CFLAGS} ${CFLAGS}" + CPPFLAGS="${LZ4_CFLAGS} ${CPPFLAGS}" AC_CHECK_HEADERS([lz4.h],[have_lz4h="yes"], []) @@ -187,31 +187,32 @@ if test "x$enable_lz4" = "xyes"; then ]) ], [AC_MSG_ERROR([Cannot find proper lz4 version (>= 1.8.0)])]) LDFLAGS=${saved_LDFLAGS} - - if test "x${have_lz4}" = "xyes"; then - AC_DEFINE([LZ4_ENABLED], [1], [Define to 1 if lz4 is enabled.]) - - if test "x${have_lz4hc}" = "xyes"; then - AC_DEFINE([LZ4HC_ENABLED], [1], [Define to 1 if lz4hc is enabled.]) - fi - - if test "x${lz4_force_static}" = "xyes"; then - LDFLAGS="-all-static ${LDFLAGS}" - else - test -z "${with_lz4_libdir}" || LZ4_LIBS="-R ${with_lz4_libdir} $LZ4_LIBS" - fi - LIBS="$LZ4_LIBS $LIBS" - fi fi - CFLAGS=${saved_CPPFLAGS} + CPPFLAGS=${saved_CPPFLAGS} fi +# Set up needed symbols, conditionals and compiler/linker flags +AM_CONDITIONAL([ENABLE_LZ4], [test "x${have_lz4}" = "xyes"]) +AM_CONDITIONAL([ENABLE_LZ4HC], [test "x${have_lz4hc}" = "xyes"]) + if test "x$have_uuid" = "xyes"; then AC_DEFINE([HAVE_LIBUUID], 1, [Define to 1 if libuuid is found]) fi -AM_CONDITIONAL([ENABLE_LZ4], [test "x${have_lz4}" = "xyes"]) -AM_CONDITIONAL([ENABLE_LZ4HC], [test "x${have_lz4hc}" = "xyes"]) +if test "x${have_lz4}" = "xyes"; then + AC_DEFINE([LZ4_ENABLED], [1], [Define to 1 if lz4 is enabled.]) + + if test "x${have_lz4hc}" = "xyes"; then + AC_DEFINE([LZ4HC_ENABLED], [1], [Define to 1 if lz4hc is enabled.]) + fi + + if test "x${lz4_force_static}" = "xyes"; then + LDFLAGS="-all-static ${LDFLAGS}" + else + test -z "${with_lz4_libdir}" || LZ4_LIBS="-R ${with_lz4_libdir} $LZ4_LIBS" + fi + LIBS="$LZ4_LIBS $LIBS" +fi AC_CONFIG_FILES([Makefile man/Makefile |