Skip to content

Commit 793402e

Browse files
authored
GH-132983: Use a standard autoconf version check for zstd (#133479)
1 parent c4bcc6a commit 793402e

File tree

2 files changed

+27
-162
lines changed

2 files changed

+27
-162
lines changed

configure

+22-139
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

+5-23
Original file line numberDiff line numberDiff line change
@@ -5386,32 +5386,14 @@ PKG_CHECK_MODULES([LIBLZMA], [liblzma], [have_liblzma=yes], [
53865386
])
53875387
])
53885388

5389-
have_libzstd=no
5390-
AC_DEFUN([TEST_ZSTD_VERSION],[
5391-
AC_MSG_CHECKING([if libzstd is new enough])
5392-
5393-
dnl TODO(emmatyping): check if we can set a C define for the minimum version
5394-
dnl to re-use here and in the header compile check
5395-
5396-
dnl This is checked when both a package is found and we do fallback searches
5397-
dnl If you update the minimum version here, you should update the compile
5398-
dnl check in Modules/_zstd/_zstdmodule.h
5399-
AC_RUN_IFELSE([AC_LANG_PROGRAM([@%:@include "zstd.h"], [
5400-
#if ZSTD_VERSION_NUMBER < 10405
5401-
exit(1);
5402-
#endif
5403-
])], [py__zstd_too_old=no], [py__zstd_too_old=yes])
5404-
dnl Important to record that we have libzstd
5405-
have_libzstd=yes
5406-
])
5407-
5408-
PKG_CHECK_MODULES([LIBZSTD], [libzstd], [TEST_ZSTD_VERSION()], [
5389+
dnl zstd 1.4.5 added ZDICT_finalizeDictionary
5390+
PKG_CHECK_MODULES([LIBZSTD], [libzstd >= 1.4.5], [have_libzstd=yes], [
54095391
WITH_SAVE_ENV([
54105392
CPPFLAGS="$CPPFLAGS $LIBZSTD_CFLAGS"
54115393
LIBS="$LIBS $LIBZSTD_LIBS"
54125394
AC_CHECK_HEADERS([zstd.h zdict.h], [
5413-
AC_CHECK_LIB([zstd], [ZDICT_finalizeDictionary],
5414-
[TEST_ZSTD_VERSION()], [have_libzstd=no])
5395+
PY_CHECK_LIB([zstd], [ZDICT_finalizeDictionary],
5396+
[have_libzstd=yes], [have_libzstd=no])
54155397
], [have_libzstd=no])
54165398
AS_VAR_IF([have_libzstd], [yes], [
54175399
LIBZSTD_CFLAGS=${LIBZSTD_CFLAGS-""}
@@ -8072,7 +8054,7 @@ PY_STDLIB_MOD([_bz2], [], [test "$have_bzip2" = yes],
80728054
[$BZIP2_CFLAGS], [$BZIP2_LIBS])
80738055
PY_STDLIB_MOD([_lzma], [], [test "$have_liblzma" = yes],
80748056
[$LIBLZMA_CFLAGS], [$LIBLZMA_LIBS])
8075-
PY_STDLIB_MOD([_zstd], [test "$py__zstd_too_old" = no], [test "$have_libzstd" = yes],
8057+
PY_STDLIB_MOD([_zstd], [], [test "$have_libzstd" = yes],
80768058
[$LIBZSTD_CFLAGS], [$LIBZSTD_LIBS])
80778059

80788060
dnl OpenSSL bindings

0 commit comments

Comments
 (0)