Skip to content

Commit f3dd7f7

Browse files
committed
Support finding libzstd not in pkg-config
GH-133479 removed the logic to check for libzstd outside of pkg-config. This commit adds that logic back with a check for the version so that users can provide their own libzstd. This is to bring parity with lzma, bz2, and zlib detection.
1 parent 3dfed23 commit f3dd7f7

File tree

3 files changed

+291
-3
lines changed

3 files changed

+291
-3
lines changed

configure

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

configure.ac

+21-1
Original file line numberDiff line numberDiff line change
@@ -5387,7 +5387,27 @@ PKG_CHECK_MODULES([LIBLZMA], [liblzma], [have_liblzma=yes], [
53875387
])
53885388

53895389
dnl zstd 1.4.5 stabilised ZDICT_finalizeDictionary
5390-
PKG_CHECK_MODULES([LIBZSTD], [libzstd >= 1.4.5], [have_libzstd=yes], [have_libzstd=no])
5390+
PKG_CHECK_MODULES([LIBZSTD], [libzstd >= 1.4.5], [have_libzstd=yes], [
5391+
WITH_SAVE_ENV([
5392+
CPPFLAGS="$CPPFLAGS $LIBZSTD_CFLAGS"
5393+
CFLAGS="$CFLAGS $LIBZSTD_CFLAGS"
5394+
LIBS="$LIBS $LIBZSTD_LIBS"
5395+
AC_CHECK_HEADERS([zstd.h zdict.h], [
5396+
PY_CHECK_LIB([zstd], [ZDICT_finalizeDictionary], [
5397+
AC_RUN_IFELSE([AC_LANG_PROGRAM([@%:@include "zstd.h"], [
5398+
#if ZSTD_VERSION_NUMBER < 10405
5399+
exit(1);
5400+
#endif
5401+
])
5402+
], [have_libzstd=yes], [have_libzstd=no])
5403+
], [have_libzstd=no])
5404+
], [have_libzstd=no])
5405+
AS_VAR_IF([have_libzstd], [yes], [
5406+
LIBZSTD_CFLAGS=${LIBZSTD_CFLAGS-""}
5407+
LIBZSTD_LIBS=${LIBZSTD_LIBS-"-lzstd"}
5408+
])
5409+
])
5410+
])
53915411

53925412
dnl PY_CHECK_NETDB_FUNC(FUNCTION)
53935413
AC_DEFUN([PY_CHECK_NETDB_FUNC], [PY_CHECK_FUNC([$1], [@%:@include <netdb.h>])])

pyconfig.h.in

+6
Original file line numberDiff line numberDiff line change
@@ -1630,12 +1630,18 @@
16301630
/* Define to 1 if you have the 'writev' function. */
16311631
#undef HAVE_WRITEV
16321632

1633+
/* Define to 1 if you have the <zdict.h> header file. */
1634+
#undef HAVE_ZDICT_H
1635+
16331636
/* Define if the zlib library has inflateCopy */
16341637
#undef HAVE_ZLIB_COPY
16351638

16361639
/* Define to 1 if you have the <zlib.h> header file. */
16371640
#undef HAVE_ZLIB_H
16381641

1642+
/* Define to 1 if you have the <zstd.h> header file. */
1643+
#undef HAVE_ZSTD_H
1644+
16391645
/* Define to 1 if you have the '_getpty' function. */
16401646
#undef HAVE__GETPTY
16411647

0 commit comments

Comments
 (0)