https://github.com/python/cpython/commit/f8691901d734388a776fe3b66a92ee1dcd11c2f1
commit: f8691901d734388a776fe3b66a92ee1dcd11c2f1
branch: main
author: Adam Turner <9087854+aa-tur...@users.noreply.github.com>
committer: hugovk <1324225+hug...@users.noreply.github.com>
date: 2025-05-06T15:04:50+03:00
summary:

GH-132983: Remove zstd version check in the header file (#133502)

files:
M Modules/_zstd/_zstdmodule.h
M configure
M configure.ac
M pyconfig.h.in

diff --git a/Modules/_zstd/_zstdmodule.h b/Modules/_zstd/_zstdmodule.h
index d50f1489e6f574..9322ee259c5124 100644
--- a/Modules/_zstd/_zstdmodule.h
+++ b/Modules/_zstd/_zstdmodule.h
@@ -12,14 +12,6 @@ Python module.
 #include "zdict.h"
 
 
-// if you update the minimum version, you should update the compile
-// check in configure.ac
-#define PYTHON_MINIMUM_SUPPORTED_ZSTD_VERSION 10405
-
-#if ZSTD_VERSION_NUMBER < PYTHON_MINIMUM_SUPPORTED_ZSTD_VERSION
-    #error "_zstd module requires zstd v1.4.5+"
-#endif
-
 /* Forward declaration of module state */
 typedef struct _zstd_state _zstd_state;
 
diff --git a/configure b/configure
index 29b3243ef64606..c51192f12c8223 100755
--- a/configure
+++ b/configure
@@ -22451,199 +22451,11 @@ fi
         # Put the nasty error message in config.log where it belongs
         echo "$LIBZSTD_PKG_ERRORS" >&5
 
-
-  save_CFLAGS=$CFLAGS
-save_CPPFLAGS=$CPPFLAGS
-save_LDFLAGS=$LDFLAGS
-save_LIBS=$LIBS
-
-
-    CPPFLAGS="$CPPFLAGS $LIBZSTD_CFLAGS"
-    LIBS="$LIBS $LIBZSTD_LIBS"
-           for ac_header in zstd.h zdict.h
-do :
-  as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | sed "$as_sed_sh"`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" 
"$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"
-then :
-  cat >>confdefs.h <<_ACEOF
-#define `printf "%s\n" "HAVE_$ac_header" | sed "$as_sed_cpp"` 1
-_ACEOF
-
-      py_check_lib_save_LIBS=$LIBS
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 
ZDICT_finalizeDictionary in -lzstd" >&5
-printf %s "checking for ZDICT_finalizeDictionary in -lzstd... " >&6; }
-if test ${ac_cv_lib_zstd_ZDICT_finalizeDictionary+y}
-then :
-  printf %s "(cached) " >&6
-else case e in #(
-  e) ac_check_lib_save_LIBS=$LIBS
-LIBS="-lzstd  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.
-   The 'extern "C"' is for builds by C++ compilers;
-   although this is not generally supported in C code supporting it here
-   has little cost and some practical benefit (sr 110532).  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char ZDICT_finalizeDictionary (void);
-int
-main (void)
-{
-return ZDICT_finalizeDictionary ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"
-then :
-  ac_cv_lib_zstd_ZDICT_finalizeDictionary=yes
-else case e in #(
-  e) ac_cv_lib_zstd_ZDICT_finalizeDictionary=no ;;
-esac
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS ;;
-esac
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: 
$ac_cv_lib_zstd_ZDICT_finalizeDictionary" >&5
-printf "%s\n" "$ac_cv_lib_zstd_ZDICT_finalizeDictionary" >&6; }
-if test "x$ac_cv_lib_zstd_ZDICT_finalizeDictionary" = xyes
-then :
-  have_libzstd=yes
-else case e in #(
-  e) have_libzstd=no ;;
-esac
-fi
-
-LIBS=$py_check_lib_save_LIBS
-
-
-else case e in #(
-  e) have_libzstd=no ;;
-esac
-fi
-
-done
-    if test "x$have_libzstd" = xyes
-then :
-
-      LIBZSTD_CFLAGS=${LIBZSTD_CFLAGS-""}
-      LIBZSTD_LIBS=${LIBZSTD_LIBS-"-lzstd"}
-
-fi
-
-CFLAGS=$save_CFLAGS
-CPPFLAGS=$save_CPPFLAGS
-LDFLAGS=$save_LDFLAGS
-LIBS=$save_LIBS
-
-
-
+        have_libzstd=no
 elif test $pkg_failed = untried; then
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
 printf "%s\n" "no" >&6; }
-
-  save_CFLAGS=$CFLAGS
-save_CPPFLAGS=$CPPFLAGS
-save_LDFLAGS=$LDFLAGS
-save_LIBS=$LIBS
-
-
-    CPPFLAGS="$CPPFLAGS $LIBZSTD_CFLAGS"
-    LIBS="$LIBS $LIBZSTD_LIBS"
-           for ac_header in zstd.h zdict.h
-do :
-  as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | sed "$as_sed_sh"`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" 
"$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"
-then :
-  cat >>confdefs.h <<_ACEOF
-#define `printf "%s\n" "HAVE_$ac_header" | sed "$as_sed_cpp"` 1
-_ACEOF
-
-      py_check_lib_save_LIBS=$LIBS
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 
ZDICT_finalizeDictionary in -lzstd" >&5
-printf %s "checking for ZDICT_finalizeDictionary in -lzstd... " >&6; }
-if test ${ac_cv_lib_zstd_ZDICT_finalizeDictionary+y}
-then :
-  printf %s "(cached) " >&6
-else case e in #(
-  e) ac_check_lib_save_LIBS=$LIBS
-LIBS="-lzstd  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.
-   The 'extern "C"' is for builds by C++ compilers;
-   although this is not generally supported in C code supporting it here
-   has little cost and some practical benefit (sr 110532).  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char ZDICT_finalizeDictionary (void);
-int
-main (void)
-{
-return ZDICT_finalizeDictionary ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"
-then :
-  ac_cv_lib_zstd_ZDICT_finalizeDictionary=yes
-else case e in #(
-  e) ac_cv_lib_zstd_ZDICT_finalizeDictionary=no ;;
-esac
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS ;;
-esac
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: 
$ac_cv_lib_zstd_ZDICT_finalizeDictionary" >&5
-printf "%s\n" "$ac_cv_lib_zstd_ZDICT_finalizeDictionary" >&6; }
-if test "x$ac_cv_lib_zstd_ZDICT_finalizeDictionary" = xyes
-then :
-  have_libzstd=yes
-else case e in #(
-  e) have_libzstd=no ;;
-esac
-fi
-
-LIBS=$py_check_lib_save_LIBS
-
-
-else case e in #(
-  e) have_libzstd=no ;;
-esac
-fi
-
-done
-    if test "x$have_libzstd" = xyes
-then :
-
-      LIBZSTD_CFLAGS=${LIBZSTD_CFLAGS-""}
-      LIBZSTD_LIBS=${LIBZSTD_LIBS-"-lzstd"}
-
-fi
-
-CFLAGS=$save_CFLAGS
-CPPFLAGS=$save_CPPFLAGS
-LDFLAGS=$save_LDFLAGS
-LIBS=$save_LIBS
-
-
-
+        have_libzstd=no
 else
         LIBZSTD_CFLAGS=$pkg_cv_LIBZSTD_CFLAGS
         LIBZSTD_LIBS=$pkg_cv_LIBZSTD_LIBS
diff --git a/configure.ac b/configure.ac
index 36d920d1337c30..a7b2f62579b0e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5386,21 +5386,8 @@ PKG_CHECK_MODULES([LIBLZMA], [liblzma], 
[have_liblzma=yes], [
   ])
 ])
 
-dnl zstd 1.4.5 added ZDICT_finalizeDictionary
-PKG_CHECK_MODULES([LIBZSTD], [libzstd >= 1.4.5], [have_libzstd=yes], [
-  WITH_SAVE_ENV([
-    CPPFLAGS="$CPPFLAGS $LIBZSTD_CFLAGS"
-    LIBS="$LIBS $LIBZSTD_LIBS"
-    AC_CHECK_HEADERS([zstd.h zdict.h], [
-      PY_CHECK_LIB([zstd], [ZDICT_finalizeDictionary],
-                   [have_libzstd=yes], [have_libzstd=no])
-    ], [have_libzstd=no])
-    AS_VAR_IF([have_libzstd], [yes], [
-      LIBZSTD_CFLAGS=${LIBZSTD_CFLAGS-""}
-      LIBZSTD_LIBS=${LIBZSTD_LIBS-"-lzstd"}
-    ])
-  ])
-])
+dnl zstd 1.4.5 stabilised ZDICT_finalizeDictionary
+PKG_CHECK_MODULES([LIBZSTD], [libzstd >= 1.4.5], [have_libzstd=yes], 
[have_libzstd=no])
 
 dnl PY_CHECK_NETDB_FUNC(FUNCTION)
 AC_DEFUN([PY_CHECK_NETDB_FUNC], [PY_CHECK_FUNC([$1], [@%:@include <netdb.h>])])
diff --git a/pyconfig.h.in b/pyconfig.h.in
index c91facbedf94e5..7586ad3f266705 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -1630,18 +1630,12 @@
 /* Define to 1 if you have the 'writev' function. */
 #undef HAVE_WRITEV
 
-/* Define to 1 if you have the <zdict.h> header file. */
-#undef HAVE_ZDICT_H
-
 /* Define if the zlib library has inflateCopy */
 #undef HAVE_ZLIB_COPY
 
 /* Define to 1 if you have the <zlib.h> header file. */
 #undef HAVE_ZLIB_H
 
-/* Define to 1 if you have the <zstd.h> header file. */
-#undef HAVE_ZSTD_H
-
 /* Define to 1 if you have the '_getpty' function. */
 #undef HAVE__GETPTY
 

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to