diff --git a/Misc/NEWS.d/next/Build/2025-09-25-01-33-12.gh-issue-139314._m9BUl.rst b/Misc/NEWS.d/next/Build/2025-09-25-01-33-12.gh-issue-139314._m9BUl.rst new file mode 100644 index 00000000000000..564d4b908c94ac --- /dev/null +++ b/Misc/NEWS.d/next/Build/2025-09-25-01-33-12.gh-issue-139314._m9BUl.rst @@ -0,0 +1 @@ +Support was added for building against `zlib-rs `__ and `libbzip2-rs `__. diff --git a/configure b/configure index 7624cbf0d2ae3d..7b5afce5217a67 100755 --- a/configure +++ b/configure @@ -1123,6 +1123,8 @@ with_pymalloc with_c_locale_coercion with_valgrind with_dtrace +with_zlib_rs +with_bzip2_rs with_libm with_libc enable_big_digits @@ -1928,6 +1930,10 @@ Optional Packages: (default is yes) --with-valgrind enable Valgrind support (default is no) --with-dtrace enable DTrace support (default is no) + --with-zlib-rs use zlib-rs, a Rust re-implementation of zlib + (default is no) + --with-bzip2-rs use bzip2-rs, a Rust re-implementation of bzip2 + (default is no) --with-libm=STRING override libm math library to STRING (default is system-dependent) --with-libc=STRING override libc C library to STRING (default is @@ -21730,21 +21736,53 @@ fi +# Check for zlib-rs +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --with-zlib-rs" >&5 +printf %s "checking for --with-zlib-rs... " >&6; } + +# Check whether --with-zlib-rs was given. +if test ${with_zlib_rs+y} +then : + withval=$with_zlib_rs; with_zlib_rs=yes +else case e in #( + e) with_zlib_rs=no ;; +esac +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_zlib_rs" >&5 +printf "%s\n" "$with_zlib_rs" >&6; } + +if test "x$with_zlib_rs" = xyes +then : + + zlib_name="libz_rs" + zlib_version="0.5.0" + zlib_libname="z_rs" + +else case e in #( + e) + zlib_name="zlib" + zlib_version="1.2.0" + zlib_libname="z" + ;; +esac +fi + pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlib >= 1.2.0" >&5 -printf %s "checking for zlib >= 1.2.0... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $zlib_name >= $zlib_version" >&5 +printf %s "checking for $zlib_name >= $zlib_version... " >&6; } if test -n "$ZLIB_CFLAGS"; then pkg_cv_ZLIB_CFLAGS="$ZLIB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib >= 1.2.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "zlib >= 1.2.0") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$zlib_name >= \$zlib_version\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$zlib_name >= $zlib_version") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_ZLIB_CFLAGS=`$PKG_CONFIG --cflags "zlib >= 1.2.0" 2>/dev/null` + pkg_cv_ZLIB_CFLAGS=`$PKG_CONFIG --cflags "$zlib_name >= $zlib_version" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -21756,12 +21794,12 @@ if test -n "$ZLIB_LIBS"; then pkg_cv_ZLIB_LIBS="$ZLIB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib >= 1.2.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "zlib >= 1.2.0") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$zlib_name >= \$zlib_version\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$zlib_name >= $zlib_version") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_ZLIB_LIBS=`$PKG_CONFIG --libs "zlib >= 1.2.0" 2>/dev/null` + pkg_cv_ZLIB_LIBS=`$PKG_CONFIG --libs "$zlib_name >= $zlib_version" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -21782,9 +21820,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - ZLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib >= 1.2.0" 2>&1` + ZLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$zlib_name >= $zlib_version" 2>&1` else - ZLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib >= 1.2.0" 2>&1` + ZLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$zlib_name >= $zlib_version" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$ZLIB_PKG_ERRORS" >&5 @@ -21806,14 +21844,15 @@ then : printf "%s\n" "#define HAVE_ZLIB_H 1" >>confdefs.h py_check_lib_save_LIBS=$LIBS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5 -printf %s "checking for gzread in -lz... " >&6; } -if test ${ac_cv_lib_z_gzread+y} +as_ac_Lib=`printf "%s\n" "ac_cv_lib_$zlib_libname""_gzread" | sed "$as_sed_sh"` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gzread in -l$zlib_libname" >&5 +printf %s "checking for gzread in -l$zlib_libname... " >&6; } +if eval test \${$as_ac_Lib+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_check_lib_save_LIBS=$LIBS -LIBS="-lz $LIBS" +LIBS="-l$zlib_libname $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21837,9 +21876,9 @@ return gzread (); _ACEOF if ac_fn_c_try_link "$LINENO" then : - ac_cv_lib_z_gzread=yes + eval "$as_ac_Lib=yes" else case e in #( - e) ac_cv_lib_z_gzread=no ;; + e) eval "$as_ac_Lib=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ @@ -21847,9 +21886,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ LIBS=$ac_check_lib_save_LIBS ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5 -printf "%s\n" "$ac_cv_lib_z_gzread" >&6; } -if test "x$ac_cv_lib_z_gzread" = xyes +eval ac_res=\$$as_ac_Lib + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes" then : have_zlib=yes else case e in #( @@ -21870,7 +21910,7 @@ done then : ZLIB_CFLAGS=${ZLIB_CFLAGS-""} - ZLIB_LIBS=${ZLIB_LIBS-"-lz"} + ZLIB_LIBS=${ZLIB_LIBS-"-l$zlib_libname"} py_check_lib_save_LIBS=$LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inflateCopy in -lz" >&5 printf %s "checking for inflateCopy in -lz... " >&6; } @@ -21953,14 +21993,15 @@ then : printf "%s\n" "#define HAVE_ZLIB_H 1" >>confdefs.h py_check_lib_save_LIBS=$LIBS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5 -printf %s "checking for gzread in -lz... " >&6; } -if test ${ac_cv_lib_z_gzread+y} +as_ac_Lib=`printf "%s\n" "ac_cv_lib_$zlib_libname""_gzread" | sed "$as_sed_sh"` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gzread in -l$zlib_libname" >&5 +printf %s "checking for gzread in -l$zlib_libname... " >&6; } +if eval test \${$as_ac_Lib+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_check_lib_save_LIBS=$LIBS -LIBS="-lz $LIBS" +LIBS="-l$zlib_libname $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21984,9 +22025,9 @@ return gzread (); _ACEOF if ac_fn_c_try_link "$LINENO" then : - ac_cv_lib_z_gzread=yes + eval "$as_ac_Lib=yes" else case e in #( - e) ac_cv_lib_z_gzread=no ;; + e) eval "$as_ac_Lib=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ @@ -21994,9 +22035,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ LIBS=$ac_check_lib_save_LIBS ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5 -printf "%s\n" "$ac_cv_lib_z_gzread" >&6; } -if test "x$ac_cv_lib_z_gzread" = xyes +eval ac_res=\$$as_ac_Lib + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes" then : have_zlib=yes else case e in #( @@ -22017,7 +22059,7 @@ done then : ZLIB_CFLAGS=${ZLIB_CFLAGS-""} - ZLIB_LIBS=${ZLIB_LIBS-"-lz"} + ZLIB_LIBS=${ZLIB_LIBS-"-l$zlib_libname"} py_check_lib_save_LIBS=$LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inflateCopy in -lz" >&5 printf %s "checking for inflateCopy in -lz... " >&6; } @@ -22114,21 +22156,52 @@ fi +# Check for bzip2-rs +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --with-bzip2-rs" >&5 +printf %s "checking for --with-bzip2-rs... " >&6; } + +# Check whether --with-bzip2-rs was given. +if test ${with_bzip2_rs+y} +then : + withval=$with_bzip2_rs; with_bzip2_rs=yes +else case e in #( + e) with_bzip2_rs=no ;; +esac +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_bzip2_rs" >&5 +printf "%s\n" "$with_bzip2_rs" >&6; } + +if test "x$with_bzip2_rs" = xyes +then : + + bzip2_name="libbz2_rs" + bzip2_libname="bz2_rs" + +else case e in #( + e) + bzip2_name="bzip2" + bzip2_libname="bz2" + ;; +esac +fi + + pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bzip2" >&5 -printf %s "checking for bzip2... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $bzip2_name" >&5 +printf %s "checking for $bzip2_name... " >&6; } if test -n "$BZIP2_CFLAGS"; then pkg_cv_BZIP2_CFLAGS="$BZIP2_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bzip2\""; } >&5 - ($PKG_CONFIG --exists --print-errors "bzip2") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$bzip2_name\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$bzip2_name") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_BZIP2_CFLAGS=`$PKG_CONFIG --cflags "bzip2" 2>/dev/null` + pkg_cv_BZIP2_CFLAGS=`$PKG_CONFIG --cflags "$bzip2_name" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -22140,12 +22213,12 @@ if test -n "$BZIP2_LIBS"; then pkg_cv_BZIP2_LIBS="$BZIP2_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bzip2\""; } >&5 - ($PKG_CONFIG --exists --print-errors "bzip2") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$bzip2_name\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$bzip2_name") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_BZIP2_LIBS=`$PKG_CONFIG --libs "bzip2" 2>/dev/null` + pkg_cv_BZIP2_LIBS=`$PKG_CONFIG --libs "$bzip2_name" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -22166,9 +22239,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - BZIP2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "bzip2" 2>&1` + BZIP2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$bzip2_name" 2>&1` else - BZIP2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "bzip2" 2>&1` + BZIP2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$bzip2_name" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$BZIP2_PKG_ERRORS" >&5 @@ -22189,14 +22262,15 @@ if test "x$ac_cv_header_bzlib_h" = xyes then : printf "%s\n" "#define HAVE_BZLIB_H 1" >>confdefs.h - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzCompress in -lbz2" >&5 -printf %s "checking for BZ2_bzCompress in -lbz2... " >&6; } -if test ${ac_cv_lib_bz2_BZ2_bzCompress+y} + as_ac_Lib=`printf "%s\n" "ac_cv_lib_$bzip2_libname""_BZ2_bzCompress" | sed "$as_sed_sh"` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzCompress in -l$bzip2_libname" >&5 +printf %s "checking for BZ2_bzCompress in -l$bzip2_libname... " >&6; } +if eval test \${$as_ac_Lib+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_check_lib_save_LIBS=$LIBS -LIBS="-lbz2 $LIBS" +LIBS="-l$bzip2_libname $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -22220,9 +22294,9 @@ return BZ2_bzCompress (); _ACEOF if ac_fn_c_try_link "$LINENO" then : - ac_cv_lib_bz2_BZ2_bzCompress=yes + eval "$as_ac_Lib=yes" else case e in #( - e) ac_cv_lib_bz2_BZ2_bzCompress=no ;; + e) eval "$as_ac_Lib=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ @@ -22230,9 +22304,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ LIBS=$ac_check_lib_save_LIBS ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bz2_BZ2_bzCompress" >&5 -printf "%s\n" "$ac_cv_lib_bz2_BZ2_bzCompress" >&6; } -if test "x$ac_cv_lib_bz2_BZ2_bzCompress" = xyes +eval ac_res=\$$as_ac_Lib + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes" then : have_bzip2=yes else case e in #( @@ -22251,7 +22326,7 @@ done then : BZIP2_CFLAGS=${BZIP2_CFLAGS-""} - BZIP2_LIBS=${BZIP2_LIBS-"-lbz2"} + BZIP2_LIBS=${BZIP2_LIBS-"-l$bzip2_libname"} fi @@ -22281,14 +22356,15 @@ if test "x$ac_cv_header_bzlib_h" = xyes then : printf "%s\n" "#define HAVE_BZLIB_H 1" >>confdefs.h - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzCompress in -lbz2" >&5 -printf %s "checking for BZ2_bzCompress in -lbz2... " >&6; } -if test ${ac_cv_lib_bz2_BZ2_bzCompress+y} + as_ac_Lib=`printf "%s\n" "ac_cv_lib_$bzip2_libname""_BZ2_bzCompress" | sed "$as_sed_sh"` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzCompress in -l$bzip2_libname" >&5 +printf %s "checking for BZ2_bzCompress in -l$bzip2_libname... " >&6; } +if eval test \${$as_ac_Lib+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_check_lib_save_LIBS=$LIBS -LIBS="-lbz2 $LIBS" +LIBS="-l$bzip2_libname $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -22312,9 +22388,9 @@ return BZ2_bzCompress (); _ACEOF if ac_fn_c_try_link "$LINENO" then : - ac_cv_lib_bz2_BZ2_bzCompress=yes + eval "$as_ac_Lib=yes" else case e in #( - e) ac_cv_lib_bz2_BZ2_bzCompress=no ;; + e) eval "$as_ac_Lib=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ @@ -22322,9 +22398,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ LIBS=$ac_check_lib_save_LIBS ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bz2_BZ2_bzCompress" >&5 -printf "%s\n" "$ac_cv_lib_bz2_BZ2_bzCompress" >&6; } -if test "x$ac_cv_lib_bz2_BZ2_bzCompress" = xyes +eval ac_res=\$$as_ac_Lib + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes" then : have_bzip2=yes else case e in #( @@ -22343,7 +22420,7 @@ done then : BZIP2_CFLAGS=${BZIP2_CFLAGS-""} - BZIP2_LIBS=${BZIP2_LIBS-"-lbz2"} + BZIP2_LIBS=${BZIP2_LIBS-"-l$bzip2_libname"} fi diff --git a/configure.ac b/configure.ac index 7a7e32d42945b9..71ce8db7eeaf18 100644 --- a/configure.ac +++ b/configure.ac @@ -5425,7 +5425,25 @@ AH_TEMPLATE([HAVE_ZLIB_COPY], [Define if the zlib library has inflateCopy]) dnl detect zlib from Emscripten emport PY_CHECK_EMSCRIPTEN_PORT([ZLIB], [-sUSE_ZLIB]) -PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0], [ +# Check for zlib-rs +AC_MSG_CHECKING([for --with-zlib-rs]) +AC_ARG_WITH( + [zlib-rs], + [AS_HELP_STRING([--with-zlib-rs], [use zlib-rs, a Rust re-implementation of zlib (default is no)])], + [with_zlib_rs=yes], [with_zlib_rs=no]) +AC_MSG_RESULT([$with_zlib_rs]) + +AS_VAR_IF([with_zlib_rs], [yes], [ + AS_VAR_SET([zlib_name], ["libz_rs"]) + AS_VAR_SET([zlib_version], ["0.5.0"]) + AS_VAR_SET([zlib_libname], ["z_rs"]) +], [ + AS_VAR_SET([zlib_name], ["zlib"]) + AS_VAR_SET([zlib_version], ["1.2.0"]) + AS_VAR_SET([zlib_libname], ["z"]) +]) + +PKG_CHECK_MODULES([ZLIB], [$zlib_name >= $zlib_version], [ have_zlib=yes dnl zlib 1.2.0 (2003) added inflateCopy AC_DEFINE([HAVE_ZLIB_COPY], [1]) @@ -5434,11 +5452,11 @@ PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0], [ CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS" LIBS="$LIBS $ZLIB_LIBS" AC_CHECK_HEADERS([zlib.h], [ - PY_CHECK_LIB([z], [gzread], [have_zlib=yes], [have_zlib=no]) + PY_CHECK_LIB([$zlib_libname], [gzread], [have_zlib=yes], [have_zlib=no]) ], [have_zlib=no]) AS_VAR_IF([have_zlib], [yes], [ ZLIB_CFLAGS=${ZLIB_CFLAGS-""} - ZLIB_LIBS=${ZLIB_LIBS-"-lz"} + ZLIB_LIBS=${ZLIB_LIBS-"-l$zlib_libname"} PY_CHECK_LIB([z], [inflateCopy], [AC_DEFINE([HAVE_ZLIB_COPY], [1])]) ]) ]) @@ -5453,16 +5471,33 @@ AS_VAR_IF([have_zlib], [yes], [ dnl detect bzip2 from Emscripten emport PY_CHECK_EMSCRIPTEN_PORT([BZIP2], [-sUSE_BZIP2]) -PKG_CHECK_MODULES([BZIP2], [bzip2], [have_bzip2=yes], [ +# Check for bzip2-rs +AC_MSG_CHECKING([for --with-bzip2-rs]) +AC_ARG_WITH( + [bzip2-rs], + [AS_HELP_STRING([--with-bzip2-rs], [use bzip2-rs, a Rust re-implementation of bzip2 (default is no)])], + [with_bzip2_rs=yes], [with_bzip2_rs=no]) +AC_MSG_RESULT([$with_bzip2_rs]) + +AS_VAR_IF([with_bzip2_rs], [yes], [ + AS_VAR_SET([bzip2_name], ["libbz2_rs"]) + AS_VAR_SET([bzip2_libname], ["bz2_rs"]) +], [ + AS_VAR_SET([bzip2_name], ["bzip2"]) + AS_VAR_SET([bzip2_libname], ["bz2"]) +]) + + +PKG_CHECK_MODULES([BZIP2], [$bzip2_name], [have_bzip2=yes], [ WITH_SAVE_ENV([ CPPFLAGS="$CPPFLAGS $BZIP2_CFLAGS" LIBS="$LIBS $BZIP2_LIBS" AC_CHECK_HEADERS([bzlib.h], [ - AC_CHECK_LIB([bz2], [BZ2_bzCompress], [have_bzip2=yes], [have_bzip2=no]) + AC_CHECK_LIB([$bzip2_libname], [BZ2_bzCompress], [have_bzip2=yes], [have_bzip2=no]) ], [have_bzip2=no]) AS_VAR_IF([have_bzip2], [yes], [ BZIP2_CFLAGS=${BZIP2_CFLAGS-""} - BZIP2_LIBS=${BZIP2_LIBS-"-lbz2"} + BZIP2_LIBS=${BZIP2_LIBS-"-l$bzip2_libname"} ]) ]) ])