diff options
author | Christian Heimes <christian@python.org> | 2021-11-22 13:52:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-22 13:52:29 (GMT) |
commit | d9cedabeba0d87799f99c0717e81743a1c2d34ce (patch) | |
tree | aaf2829609eb71598aeba5c838e8bb76608b0a24 /configure.ac | |
parent | b451673f93465a27ee61e408190ee61cb9dbd5b6 (diff) | |
download | cpython-d9cedabeba0d87799f99c0717e81743a1c2d34ce.zip cpython-d9cedabeba0d87799f99c0717e81743a1c2d34ce.tar.gz cpython-d9cedabeba0d87799f99c0717e81743a1c2d34ce.tar.bz2 |
bpo-45847: Port compression libs to PY_STDLIB_MOD (GH-29702)
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 69 |
1 files changed, 55 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac index 224a9b9..05992dc 100644 --- a/configure.ac +++ b/configure.ac @@ -4054,24 +4054,55 @@ if test "$ac_cv_have_lchflags" = yes ; then fi dnl Check for compression libraries -AC_CHECK_HEADERS([zlib.h], [ - save_LIBS="$LIBS" - AC_CHECK_LIB([z], [gzread]) - LIBS="$save_LIBS" - AC_CHECK_LIB([z], [inflateCopy], [AC_DEFINE(HAVE_ZLIB_COPY, 1, [Define if the zlib library has inflateCopy])]) - LIBS="$save_LIBS" +AH_TEMPLATE([HAVE_ZLIB_COPY], [Define if the zlib library has inflateCopy]) + +PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0], [ + have_zlib=yes + dnl zlib 1.2.0 (2003) added inflateCopy + AC_DEFINE([HAVE_ZLIB_COPY], [1]) +], [ + AC_CHECK_HEADERS([zlib.h], [ + WITH_SAVE_ENV([ + AC_CHECK_LIB([z], [gzread], [ + have_zlib=yes + ZLIB_CFLAGS= + ZLIB_LIBS=-lz + AC_CHECK_LIB([z], [inflateCopy], [AC_DEFINE([HAVE_ZLIB_COPY], [1])]) + ], [ + have_zlib=no + ]) + ]) + ], [have_zlib=no]) ]) -AC_CHECK_HEADERS([bzlib.h], [ - save_LIBS="$LIBS" - AC_CHECK_LIB([bz2], [BZ2_bzCompress]) - LIBS="$save_LIBS" +dnl binascii can use zlib for optimized crc32. +AS_VAR_IF([have_zlib], [yes], [ + BINASCII_CFLAGS="-DUSE_ZLIB_CRC32 $ZLIB_CFLAGS" + BINASCII_LIBS="$ZLIB_LIBS" ]) -AC_CHECK_HEADERS([lzma.h], [ - save_LIBS="$LIBS" - AC_CHECK_LIB([lzma], [lzma_easy_encoder]) - LIBS="$save_LIBS" +PKG_CHECK_MODULES([BZIP2], [bzip2], [have_bzip2=yes], [ + AC_CHECK_HEADERS([bzlib.h], [ + WITH_SAVE_ENV([ + AC_CHECK_LIB([bz2], [BZ2_bzCompress], [ + have_bzip2=yes + BZIP2_CFLAGS= + BZIP2_LIBS=-lbz2 + ], [have_bzip2=no]) + ]) + ], [have_bzip2=no]) +]) + +PKG_CHECK_MODULES([LIBLZMA], [liblzma], [have_liblzma=yes], [ + AC_CHECK_HEADERS([lzma.h], [ + WITH_SAVE_ENV([ + AC_CHECK_LIB([lzma], [lzma_easy_encoder], [ + have_liblzma=yes + LIBLZMA_CFLAGS= + LIBLZMA_LIBS=-llzma + ], [have_liblzma=no]) + ]) + ], [have_liblzma=no]) ]) PY_CHECK_FUNC([hstrerror], [#include <netdb.h>]) @@ -6140,6 +6171,16 @@ PY_STDLIB_MOD([_sqlite3], [test "$have_supported_sqlite3" = "yes"], [$LIBSQLITE3_CFLAGS], [$LIBSQLITE3_LIBS]) +dnl compression libs +PY_STDLIB_MOD([zlib], [], [test "$have_zlib" = yes], + [$ZLIB_CFLAGS], [$ZLIB_LIBS]) +dnl binascii can use zlib for optimized crc32. +PY_STDLIB_MOD_SIMPLE([binascii], [$BINASCII_CFLAGS], [$BINASCII_LIBS]) +PY_STDLIB_MOD([_bz2], [], [test "$have_bzip2" = yes], + [$BZIP2_CFLAGS], [$BZIP2_LIBS]) +PY_STDLIB_MOD([_lzma], [], [test "$have_liblzma" = yes], + [$LIBLZMA_CFLAGS], [$LIBLZMA_LIBS]) + dnl test modules PY_STDLIB_MOD([_testcapi], [test "$TEST_MODULES" = yes]) PY_STDLIB_MOD([_testinternalcapi], [test "$TEST_MODULES" = yes]) |