Added experimental BZ2 support
This commit is contained in:
parent
5d37bf82aa
commit
42de42a82c
227
configure
vendored
227
configure
vendored
@ -4893,7 +4893,232 @@ fi
|
||||
done
|
||||
|
||||
fi
|
||||
BZLIBSUP=No
|
||||
echo "$as_me:$LINENO: checking for BZ2_bzCompressInit in -lbz2" >&5
|
||||
echo $ECHO_N "checking for BZ2_bzCompressInit in -lbz2... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_bz2_BZ2_bzCompressInit+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lbz2 $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char BZ2_bzCompressInit ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
BZ2_bzCompressInit ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_bz2_BZ2_bzCompressInit=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_bz2_BZ2_bzCompressInit=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_bz2_BZ2_bzCompressInit" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_bz2_BZ2_bzCompressInit" >&6
|
||||
if test $ac_cv_lib_bz2_BZ2_bzCompressInit = yes; then
|
||||
result=yes
|
||||
else
|
||||
result=no
|
||||
fi
|
||||
|
||||
if test "$result" = "yes"; then
|
||||
LIBS="$LIBS -lbz2"
|
||||
|
||||
for ac_header in bzlib.h
|
||||
do
|
||||
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
||||
echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
|
||||
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
|
||||
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
|
||||
else
|
||||
# Is the header compilable?
|
||||
echo "$as_me:$LINENO: checking $ac_header usability" >&5
|
||||
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_header_compiler=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_compiler=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
|
||||
echo "${ECHO_T}$ac_header_compiler" >&6
|
||||
|
||||
# Is the header present?
|
||||
echo "$as_me:$LINENO: checking $ac_header presence" >&5
|
||||
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
|
||||
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } >/dev/null; then
|
||||
if test -s conftest.err; then
|
||||
ac_cpp_err=$ac_c_preproc_warn_flag
|
||||
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
|
||||
else
|
||||
ac_cpp_err=
|
||||
fi
|
||||
else
|
||||
ac_cpp_err=yes
|
||||
fi
|
||||
if test -z "$ac_cpp_err"; then
|
||||
ac_header_preproc=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_preproc=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_ext
|
||||
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
|
||||
echo "${ECHO_T}$ac_header_preproc" >&6
|
||||
|
||||
# So? What about this header?
|
||||
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
|
||||
yes:no: )
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
|
||||
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
|
||||
ac_header_preproc=yes
|
||||
;;
|
||||
no:yes:* )
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
|
||||
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
|
||||
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
|
||||
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
|
||||
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
|
||||
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
|
||||
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
|
||||
(
|
||||
cat <<\_ASBOX
|
||||
## ------------------------------------------ ##
|
||||
## Report this to the AC_PACKAGE_NAME lists. ##
|
||||
## ------------------------------------------ ##
|
||||
_ASBOX
|
||||
) |
|
||||
sed "s/^/$as_me: WARNING: /" >&2
|
||||
;;
|
||||
esac
|
||||
echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
|
||||
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
eval "$as_ac_Header=\$ac_header_preproc"
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
|
||||
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
|
||||
|
||||
fi
|
||||
if test `eval echo '${'$as_ac_Header'}'` = yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
BZLIBSUP=Yes
|
||||
else
|
||||
BZLIBSUP=No
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if test "$SYSTEM" = "NetBSD"; then
|
||||
@ -10332,6 +10557,7 @@ echo "$as_me:$LINENO: result:
|
||||
|
||||
Version : ..................... ${VERSION}
|
||||
Hydra/Binkp zlib compression : ${ZLIBSUP}
|
||||
Binkp bzlib compression : ..... ${BZLIBSUP}
|
||||
Full newsgate : ............... ${NEWSGATE}
|
||||
Delete key : .................. ${DEL}
|
||||
|
||||
@ -10343,6 +10569,7 @@ echo "${ECHO_T}
|
||||
|
||||
Version : ..................... ${VERSION}
|
||||
Hydra/Binkp zlib compression : ${ZLIBSUP}
|
||||
Binkp bzlib compression : ..... ${BZLIBSUP}
|
||||
Full newsgate : ............... ${NEWSGATE}
|
||||
Delete key : .................. ${DEL}
|
||||
|
||||
|
26
configure.in
26
configure.in
@ -180,7 +180,7 @@ fi
|
||||
|
||||
|
||||
dnl
|
||||
dnl Support for zlib transfers compression
|
||||
dnl Support for zlib and bzlib transfers compression
|
||||
dnl
|
||||
ZLIBSUP=No
|
||||
AC_CHECK_LIB(z,compress2,result=yes,result=no)
|
||||
@ -188,7 +188,12 @@ if test "$result" = "yes"; then
|
||||
LIBS="$LIBS -lz"
|
||||
AC_CHECK_HEADERS(zlib.h,ZLIBSUP=Yes,ZLIBSUP=No)
|
||||
fi
|
||||
|
||||
BZLIBSUP=No
|
||||
AC_CHECK_LIB(bz2,BZ2_bzCompressInit,result=yes,result=no)
|
||||
if test "$result" = "yes"; then
|
||||
LIBS="$LIBS -lbz2"
|
||||
AC_CHECK_HEADERS(bzlib.h,BZLIBSUP=Yes,BZLIBSUP=No)
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl The last library to add, according to Sun the -lpthread must be the
|
||||
@ -305,22 +310,6 @@ else
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(GBK_DEL,$GBK_DEL)
|
||||
|
||||
dnl
|
||||
dnl AC_ARG_WITH(log-compress,[ --with-log-compress=METHOD Log compression method (default gzip)], LOG_COMPRESS=$with_log_compress, LOG_COMPRESS=gzip)
|
||||
dnl case "$LOG_COMPRESS" in
|
||||
dnl gzip)
|
||||
dnl LOG_COMPRESS=$GZIP
|
||||
dnl LOG_COMPRESSEXT=".gz" ;;
|
||||
dnl compress)
|
||||
dnl LOG_COMPRESS=$COMPRESS
|
||||
dnl LOG_COMPRESSEXT=".Z" ;;
|
||||
dnl *)
|
||||
dnl LOG_COMPRESS=$LOG_COMPRESS
|
||||
dnl LOG_COMPRESSEXT=".unknown" ;;
|
||||
dnl esac
|
||||
dnl AC_SUBST(LOG_COMPRESS)
|
||||
dnl AC_SUBST(LOG_COMPRESSEXT)
|
||||
dnl
|
||||
|
||||
AC_MSG_CHECKING(location of joe editor)
|
||||
for joebin in /usr/bin /usr/local/bin /usr/pkg/bin NONE; do
|
||||
@ -397,6 +386,7 @@ AC_MSG_RESULT([
|
||||
|
||||
Version : ..................... ${VERSION}
|
||||
Hydra/Binkp zlib compression : ${ZLIBSUP}
|
||||
Binkp bzlib compression : ..... ${BZLIBSUP}
|
||||
Full newsgate : ............... ${NEWSGATE}
|
||||
Delete key : .................. ${DEL}
|
||||
|
||||
|
@ -89,6 +89,9 @@
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_BZLIB_H
|
||||
#include <bzlib.h>
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
#if !defined(__ppc__)
|
||||
#include <sys/poll.h>
|
||||
|
@ -1585,7 +1585,7 @@ TrType binkp_transmitter(void)
|
||||
sz = bp.tfsize - ftell(bp.txfp);
|
||||
if (bp.cmpblksize < sz)
|
||||
sz = bp.cmpblksize;
|
||||
Syslog('b', "Binkp: sz=%d", sz);
|
||||
// Syslog('b', "Binkp: sz=%d", sz);
|
||||
while (TRUE) {
|
||||
ocnt = bp.cmpblksize - nput;
|
||||
nget = sz;
|
||||
@ -1594,7 +1594,7 @@ TrType binkp_transmitter(void)
|
||||
fleft = bp.tfsize - ftell(bp.txfp);
|
||||
fseek(bp.txfp, bp.txpos, SEEK_SET);
|
||||
nget = fread(bp.z_obuf, 1, nget, bp.txfp);
|
||||
Syslog('b', "Binkp: fread pos=%d nget=%d ocnt=%d", bp.txpos, nget, ocnt);
|
||||
// Syslog('b', "Binkp: fread pos=%d nget=%d ocnt=%d", bp.txpos, nget, ocnt);
|
||||
rc2 = do_compress(bp.tmode, bp.txbuf + nput, &ocnt, bp.z_obuf, &nget, fleft ? 0 : 1, bp.z_odata);
|
||||
Syslog('b', "Binkp: do_compress ocnt=%d nget=%d fleft=%d rc=%d", ocnt, nget, fleft, rc2);
|
||||
if (rc2 == -1) {
|
||||
@ -1604,17 +1604,25 @@ TrType binkp_transmitter(void)
|
||||
bp.txpos += nget;
|
||||
bp.txcpos += ocnt;
|
||||
nput += ocnt;
|
||||
Syslog('b', "Binkp: txpos=%d txcpos=%d nput=%d", bp.txpos, bp.txcpos, nput);
|
||||
// Syslog('b', "Binkp: txpos=%d txcpos=%d nput=%d", bp.txpos, bp.txcpos, nput);
|
||||
|
||||
/*
|
||||
* Compressed block is filled for transmission
|
||||
*/
|
||||
if ((nput == bp.cmpblksize) || (fleft == 0)) {
|
||||
rc = binkp_send_frame(FALSE, bp.txbuf, nput);
|
||||
bp.txlen = nput;
|
||||
rc = binkp_send_frame(FALSE, bp.txbuf, bp.txlen);
|
||||
if (rc)
|
||||
return Failure;
|
||||
nput = 0;
|
||||
sentbytes += nput;
|
||||
}
|
||||
sentbytes += bp.txlen;
|
||||
|
||||
if (rc2 == 1) {
|
||||
/*
|
||||
* Last compressed block is sent, set eof.
|
||||
*/
|
||||
eof = TRUE;
|
||||
bp.txcompressed = bp.tfsize - bp.txcpos;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user