From 04a991ce4fba7c149df537f3050af0e600c23b28 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 26 Feb 2001 22:14:59 +0000 Subject: [PATCH] Updated for BZIP2 1.0.X. Configure script doesn't enable 64 bit LFS on broken glibc on Redhat 7.0. --- buildconf.sh | 5 ++++- configure.in | 35 +++++++++++++++++++++++++++-------- index/recindex.c | 20 +++++++++++++++++--- 3 files changed, 48 insertions(+), 12 deletions(-) diff --git a/buildconf.sh b/buildconf.sh index 2fd848b..1e682b1 100755 --- a/buildconf.sh +++ b/buildconf.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: buildconf.sh,v 1.3 2001-02-26 21:21:50 adam Exp $ +# $Id: buildconf.sh,v 1.4 2001-02-26 22:14:59 adam Exp $ dir=`aclocal --print-ac-dir` if [ -f $dir/yaz.m4 ]; then aclocal || exit 1 @@ -8,3 +8,6 @@ else fi automake -a >/dev/null 2>&1 || exit 2 autoconf || exit 3 +if [ -f config.cache ]; then + rm config.cache +fi diff --git a/configure.in b/configure.in index 1a38773..b34226d 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Zebra, Index Data Aps, 1994-2000 -dnl $Id: configure.in,v 1.26 2001-02-21 09:52:39 adam Exp $ +dnl $Id: configure.in,v 1.27 2001-02-26 22:14:59 adam Exp $ dnl AC_INIT(include/zebraver.h) AC_MSG_CHECKING(for package) @@ -83,6 +83,11 @@ dnl ------- BZIP2 AC_CHECK_LIB(bz2,bzCompressInit) if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then AC_CHECK_HEADERS(bzlib.h) +else + AC_CHECK_LIB(bz2,BZ2_bzCompressInit) + if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then + AC_CHECK_HEADERS(bzlib.h) + fi fi dnl ------- 64 bit files AC_MSG_CHECKING(for LFS) @@ -91,17 +96,31 @@ AC_TRY_RUN([#define _FILE_OFFSET_BITS 64 #include #include #include +#include +#include int main(int argc, char **argv) { off_t o; char tmp_str[32]; - if (sizeof(off_t) == 8) { - o = 2000000000; - sprintf (tmp_str, "%Ld", o+o+o); - if (!strcmp (tmp_str, "6000000000")) - exit (0); - } - exit (1); + int fd; + struct flock area; + if (sizeof(off_t) != 8) + exit (1); + o = 2000000000; + sprintf (tmp_str, "%Ld", o+o+o); + if (strcmp (tmp_str, "6000000000")) + exit (1); + fd = creat ("config.tmp", 0644); + if (fd < 0) + exit (1); + area.l_type = F_WRLCK; + area.l_whence = SEEK_SET; + area.l_len = area.l_start = 0L; + if (fcntl(fd, F_SETLKW, &area)) + exit (1); + close (fd); + unlink ("config.tmp"); + exit (0); } ],bits=64,bits=32,bits=32) if test "$bits" = "64"; then diff --git a/index/recindex.c b/index/recindex.c index 5fbbaed..72e8259 100644 --- a/index/recindex.c +++ b/index/recindex.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: recindex.c,v $ - * Revision 1.30 2000-07-13 10:14:20 heikki + * Revision 1.31 2001-02-26 22:14:59 adam + * Updated for BZIP2 1.0.X. Configure script doesn't enable 64 bit LFS + * on broken glibc on Redhat 7.0. + * + * Revision 1.30 2000/07/13 10:14:20 heikki * Removed compiler warnings when making zebra * * Revision 1.29 2000/04/05 09:49:35 adam @@ -535,7 +539,12 @@ static void rec_write_multiple (Records p, int saveCount) #if HAVE_BZLIB_H csize = out_offset + (out_offset >> 6) + 620; rec_tmp_expand (p, csize); - i = bzBuffToBuffCompress (p->tmp_buf+sizeof(int)+sizeof(short)+ +#ifdef BZ_CONFIG_ERROR + i = BZ2_bzBuffToBuffCompress +#else + i = bzBuffToBuffCompress +#endif + (p->tmp_buf+sizeof(int)+sizeof(short)+ sizeof(char), &csize, out_buf, out_offset, 1, 0, 30); if (i != BZ_OK) @@ -731,7 +740,12 @@ static Record rec_get_int (Records p, int sysno) while (1) { bz_buf = (char *) xmalloc (bz_size); - i = bzBuffToBuffDecompress (bz_buf, &bz_size, in_buf, in_size, 0, 0); +#ifdef BZ_CONFIG_ERROR + i = BZ2_bzBuffToBuffDecompress +#else + i = bzBuffToBuffDecompress +#endif + (bz_buf, &bz_size, in_buf, in_size, 0, 0); logf (LOG_LOG, "decompress %5d %5d", in_size, bz_size); if (i == BZ_OK) break; -- 1.7.10.4