mirror of https://github.com/python/cpython
bpo-45763: Detect compression build deps in configure (GH-29483)
This commit is contained in:
parent
185533639d
commit
5b7c7cb104
|
@ -524,6 +524,9 @@ Build Changes
|
|||
(Contributed by Brett Cannon and Christian Heimes in :issue:`45548`,
|
||||
:issue:`45570`, :issue:`45571`, and :issue:`43974`.)
|
||||
|
||||
* The build dependencies for :mod:`zlib`, :mod:`bz2`, and :mod:`lzma` are now
|
||||
detected by :program:`configure`.
|
||||
(Contributed by Christian Heimes in :issue:`45763`.)
|
||||
|
||||
C API Changes
|
||||
=============
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
The build dependencies for :mod:`zlib`, :mod:`bz2`, and :mod:`lzma` are now
|
||||
detected by ``configure``.
|
|
@ -12884,7 +12884,61 @@ $as_echo "#define HAVE_LCHFLAGS 1" >>confdefs.h
|
|||
|
||||
fi
|
||||
|
||||
# Check for compression libraries
|
||||
for ac_header in zlib.h
|
||||
do :
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_zlib_h" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_ZLIB_H 1
|
||||
_ACEOF
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5
|
||||
$as_echo_n "checking for gzread in -lz... " >&6; }
|
||||
if ${ac_cv_lib_z_gzread+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lz $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. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char gzread ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return gzread ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_lib_z_gzread=yes
|
||||
else
|
||||
ac_cv_lib_z_gzread=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5
|
||||
$as_echo "$ac_cv_lib_z_gzread" >&6; }
|
||||
if test "x$ac_cv_lib_z_gzread" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_LIBZ 1
|
||||
_ACEOF
|
||||
|
||||
LIBS="-lz $LIBS"
|
||||
|
||||
fi
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateCopy in -lz" >&5
|
||||
$as_echo_n "checking for inflateCopy in -lz... " >&6; }
|
||||
if ${ac_cv_lib_z_inflateCopy+:} false; then :
|
||||
|
@ -12927,6 +12981,134 @@ $as_echo "#define HAVE_ZLIB_COPY 1" >>confdefs.h
|
|||
|
||||
fi
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
for ac_header in bzlib.h
|
||||
do :
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_bzlib_h" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_BZLIB_H 1
|
||||
_ACEOF
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzCompress in -lbz2" >&5
|
||||
$as_echo_n "checking for BZ2_bzCompress in -lbz2... " >&6; }
|
||||
if ${ac_cv_lib_bz2_BZ2_bzCompress+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lbz2 $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. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char BZ2_bzCompress ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return BZ2_bzCompress ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_lib_bz2_BZ2_bzCompress=yes
|
||||
else
|
||||
ac_cv_lib_bz2_BZ2_bzCompress=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bz2_BZ2_bzCompress" >&5
|
||||
$as_echo "$ac_cv_lib_bz2_BZ2_bzCompress" >&6; }
|
||||
if test "x$ac_cv_lib_bz2_BZ2_bzCompress" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_LIBBZ2 1
|
||||
_ACEOF
|
||||
|
||||
LIBS="-lbz2 $LIBS"
|
||||
|
||||
fi
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
for ac_header in lzma.h
|
||||
do :
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_lzma_h" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_LZMA_H 1
|
||||
_ACEOF
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzma_easy_encoder in -llzma" >&5
|
||||
$as_echo_n "checking for lzma_easy_encoder in -llzma... " >&6; }
|
||||
if ${ac_cv_lib_lzma_lzma_easy_encoder+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-llzma $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. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char lzma_easy_encoder ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return lzma_easy_encoder ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_lib_lzma_lzma_easy_encoder=yes
|
||||
else
|
||||
ac_cv_lib_lzma_lzma_easy_encoder=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lzma_lzma_easy_encoder" >&5
|
||||
$as_echo "$ac_cv_lib_lzma_lzma_easy_encoder" >&6; }
|
||||
if test "x$ac_cv_lib_lzma_lzma_easy_encoder" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_LIBLZMA 1
|
||||
_ACEOF
|
||||
|
||||
LIBS="-llzma $LIBS"
|
||||
|
||||
fi
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
23
configure.ac
23
configure.ac
|
@ -3830,9 +3830,26 @@ if test "$ac_cv_have_lchflags" = yes ; then
|
|||
AC_DEFINE(HAVE_LCHFLAGS, 1, [Define to 1 if you have the 'lchflags' function.])
|
||||
fi
|
||||
|
||||
# Check for compression libraries
|
||||
dnl Check if system zlib has *Copy() functions
|
||||
AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, [Define if the zlib library has inflateCopy]))
|
||||
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"
|
||||
])
|
||||
|
||||
AC_CHECK_HEADERS([bzlib.h], [
|
||||
save_LIBS="$LIBS"
|
||||
AC_CHECK_LIB([bz2], [BZ2_bzCompress])
|
||||
LIBS="$save_LIBS"
|
||||
])
|
||||
|
||||
AC_CHECK_HEADERS([lzma.h], [
|
||||
save_LIBS="$LIBS"
|
||||
AC_CHECK_LIB([lzma], [lzma_easy_encoder])
|
||||
LIBS="$save_LIBS"
|
||||
])
|
||||
|
||||
PY_CHECK_FUNC([hstrerror], [#include <netdb.h>])
|
||||
|
||||
|
|
|
@ -124,6 +124,9 @@
|
|||
/* Has builtin __atomic_load_n() and __atomic_store_n() functions */
|
||||
#undef HAVE_BUILTIN_ATOMIC
|
||||
|
||||
/* Define to 1 if you have the <bzlib.h> header file. */
|
||||
#undef HAVE_BZLIB_H
|
||||
|
||||
/* Define to 1 if you have the 'chflags' function. */
|
||||
#undef HAVE_CHFLAGS
|
||||
|
||||
|
@ -580,6 +583,9 @@
|
|||
/* Define to 1 if you have the `lchown' function. */
|
||||
#undef HAVE_LCHOWN
|
||||
|
||||
/* Define to 1 if you have the `bz2' library (-lbz2). */
|
||||
#undef HAVE_LIBBZ2
|
||||
|
||||
/* Define to 1 if you have the `dl' library (-ldl). */
|
||||
#undef HAVE_LIBDL
|
||||
|
||||
|
@ -592,6 +598,9 @@
|
|||
/* Define to 1 if you have the <libintl.h> header file. */
|
||||
#undef HAVE_LIBINTL_H
|
||||
|
||||
/* Define to 1 if you have the `lzma' library (-llzma). */
|
||||
#undef HAVE_LIBLZMA
|
||||
|
||||
/* Define to build the readline module. */
|
||||
#undef HAVE_LIBREADLINE
|
||||
|
||||
|
@ -607,6 +616,9 @@
|
|||
/* Define to 1 if you have the `uuid' library (-luuid). */
|
||||
#undef HAVE_LIBUUID
|
||||
|
||||
/* Define to 1 if you have the `z' library (-lz). */
|
||||
#undef HAVE_LIBZ
|
||||
|
||||
/* Define if you have the 'link' function. */
|
||||
#undef HAVE_LINK
|
||||
|
||||
|
@ -670,6 +682,9 @@
|
|||
/* Define to 1 if you have the `lutimes' function. */
|
||||
#undef HAVE_LUTIMES
|
||||
|
||||
/* Define to 1 if you have the <lzma.h> header file. */
|
||||
#undef HAVE_LZMA_H
|
||||
|
||||
/* Define to 1 if you have the `madvise' function. */
|
||||
#undef HAVE_MADVISE
|
||||
|
||||
|
@ -1342,6 +1357,9 @@
|
|||
/* 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 `_getpty' function. */
|
||||
#undef HAVE__GETPTY
|
||||
|
||||
|
|
9
setup.py
9
setup.py
|
@ -1634,10 +1634,7 @@ class PyBuildExt(build_ext):
|
|||
|
||||
def detect_compress_exts(self):
|
||||
# Andrew Kuchling's zlib module.
|
||||
have_zlib = (
|
||||
find_file('zlib.h', self.inc_dirs, []) is not None and
|
||||
self.compiler.find_library_file(self.lib_dirs, 'z')
|
||||
)
|
||||
have_zlib = sysconfig.get_config_var("HAVE_LIBZ")
|
||||
if have_zlib:
|
||||
self.add(Extension('zlib', ['zlibmodule.c'],
|
||||
libraries=['z']))
|
||||
|
@ -1657,14 +1654,14 @@ class PyBuildExt(build_ext):
|
|||
libraries=libraries))
|
||||
|
||||
# Gustavo Niemeyer's bz2 module.
|
||||
if (self.compiler.find_library_file(self.lib_dirs, 'bz2')):
|
||||
if sysconfig.get_config_var("HAVE_LIBBZ2"):
|
||||
self.add(Extension('_bz2', ['_bz2module.c'],
|
||||
libraries=['bz2']))
|
||||
else:
|
||||
self.missing.append('_bz2')
|
||||
|
||||
# LZMA compression support.
|
||||
if self.compiler.find_library_file(self.lib_dirs, 'lzma'):
|
||||
if sysconfig.get_config_var("HAVE_LIBLZMA"):
|
||||
self.add(Extension('_lzma', ['_lzmamodule.c'],
|
||||
libraries=['lzma']))
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue