mirror of
https://github.com/fadden/nulib2.git
synced 2025-01-14 01:29:43 +00:00
Added support for compressing data with libbz2. Disabled by default.
Generalized compression method enable/disable. Now any method can be removed. Applications can call NuTestFeature() to figure out what is supported by the copy of NufxLib they're linked against.
This commit is contained in:
parent
21c4d9027a
commit
d41016e6c1
@ -79,7 +79,11 @@ Nu_NuArchiveNew(NuArchive** ppArchive)
|
||||
*/
|
||||
(*ppArchive)->valAllowDuplicates = false;
|
||||
(*ppArchive)->valConvertExtractedEOL = kNuConvertOff;
|
||||
#ifdef ENABLE_LZW
|
||||
(*ppArchive)->valDataCompression = kNuCompressLZW2;
|
||||
#else
|
||||
(*ppArchive)->valDataCompression = kNuCompressNone;
|
||||
#endif
|
||||
(*ppArchive)->valDiscardWrapper = false;
|
||||
(*ppArchive)->valEOL = kNuEOLLF; /* non-UNIX apps must override */
|
||||
(*ppArchive)->valHandleExisting = kNuMaybeOverwrite;
|
||||
|
299
nufxlib-0/Bzip2.c
Normal file
299
nufxlib-0/Bzip2.c
Normal file
@ -0,0 +1,299 @@
|
||||
/*
|
||||
* NuFX archive manipulation library
|
||||
* Copyright (C) 2000 by Andy McFadden, All Rights Reserved.
|
||||
* This is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Library General Public License, see the file COPYING.LIB.
|
||||
*
|
||||
* Support for the "bzip2" (BTW+Huffman) algorithm, via "libbz2".
|
||||
*
|
||||
* This compression format is totally unsupported on the Apple II. This
|
||||
* is provided primarily for the benefit of Apple II emulators that want
|
||||
* a better storage format for disk images than SHK+LZW or a ZIP file.
|
||||
*
|
||||
* This code was developed and tested with libz2 version 1.0.2. Visit
|
||||
* http://sources.redhat.com/bzip2/ for more information.
|
||||
*/
|
||||
#include "NufxLibPriv.h"
|
||||
|
||||
#ifdef ENABLE_BZIP2
|
||||
#include "bzlib.h"
|
||||
|
||||
#define kBZBlockSize 8 /* use 800K blocks */
|
||||
#define kBZVerbosity 1 /* library verbosity level (0-4) */
|
||||
|
||||
|
||||
/*
|
||||
* Alloc and free functions provided to libbz2.
|
||||
*/
|
||||
static void*
|
||||
Nu_bzalloc(void* opaque, int items, int size)
|
||||
{
|
||||
return Nu_Malloc(opaque, items * size);
|
||||
}
|
||||
static void
|
||||
Nu_bzfree(void* opaque, void* address)
|
||||
{
|
||||
return Nu_Free(opaque, address);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ===========================================================================
|
||||
* Compression
|
||||
* ===========================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* Compress "srcLen" bytes from "pStraw" to "fp".
|
||||
*/
|
||||
NuError
|
||||
Nu_CompressBzip2(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
|
||||
ulong srcLen, ulong* pDstLen, ushort* pCrc)
|
||||
{
|
||||
NuError err = kNuErrNone;
|
||||
bz_stream bzstream;
|
||||
int bzerr;
|
||||
uchar* outbuf = nil;
|
||||
|
||||
Assert(pArchive != nil);
|
||||
Assert(pStraw != nil);
|
||||
Assert(fp != nil);
|
||||
Assert(srcLen > 0);
|
||||
Assert(pDstLen != nil);
|
||||
Assert(pCrc != nil);
|
||||
|
||||
err = Nu_AllocCompressionBufferIFN(pArchive);
|
||||
if (err != kNuErrNone)
|
||||
return err;
|
||||
|
||||
/* allocate a similarly-sized buffer for the output */
|
||||
outbuf = Nu_Malloc(pArchive, kNuGenCompBufSize);
|
||||
BailAlloc(outbuf);
|
||||
|
||||
/*
|
||||
* Initialize the bz2lib stream.
|
||||
*/
|
||||
bzstream.bzalloc = Nu_bzalloc;
|
||||
bzstream.bzfree = Nu_bzfree;
|
||||
bzstream.opaque = pArchive;
|
||||
bzstream.next_in = nil;
|
||||
bzstream.avail_in = 0;
|
||||
bzstream.next_out = outbuf;
|
||||
bzstream.avail_out = kNuGenCompBufSize;
|
||||
|
||||
/* fourth arg is "workFactor"; set to zero for default (30) */
|
||||
bzerr = BZ2_bzCompressInit(&bzstream, kBZBlockSize, kBZVerbosity, 0);
|
||||
if (bzerr != BZ_OK) {
|
||||
err = kNuErrInternal;
|
||||
if (bzerr == BZ_CONFIG_ERROR) {
|
||||
Nu_ReportError(NU_BLOB, err, "error configuring bz2lib");
|
||||
} else {
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"call to BZ2_bzCompressInit failed (bzerr=%d)", bzerr);
|
||||
}
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop while we have data.
|
||||
*/
|
||||
do {
|
||||
ulong getSize;
|
||||
int action;
|
||||
|
||||
/* should be able to read a full buffer every time */
|
||||
if (bzstream.avail_in == 0 && srcLen) {
|
||||
getSize = (srcLen > kNuGenCompBufSize) ? kNuGenCompBufSize : srcLen;
|
||||
DBUG(("+++ reading %ld bytes\n", getSize));
|
||||
|
||||
err = Nu_StrawRead(pArchive, pStraw, pArchive->compBuf, getSize);
|
||||
if (err != kNuErrNone) {
|
||||
Nu_ReportError(NU_BLOB, err, "deflate read failed");
|
||||
goto bz_bail;
|
||||
}
|
||||
|
||||
srcLen -= getSize;
|
||||
|
||||
*pCrc = Nu_CalcCRC16(*pCrc, pArchive->compBuf, getSize);
|
||||
|
||||
bzstream.next_in = pArchive->compBuf;
|
||||
bzstream.avail_in = getSize;
|
||||
}
|
||||
|
||||
if (srcLen == 0)
|
||||
action = BZ_FINISH; /* tell libbz2 that we're done */
|
||||
else
|
||||
action = BZ_RUN; /* more to come! */
|
||||
|
||||
bzerr = BZ2_bzCompress(&bzstream, action);
|
||||
if (bzerr != BZ_RUN_OK && bzerr != BZ_FINISH_OK && bzerr != BZ_STREAM_END)
|
||||
{
|
||||
err = kNuErrInternal;
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"libbz2 compress call failed (bzerr=%d)", bzerr);
|
||||
goto bz_bail;
|
||||
}
|
||||
|
||||
/* write when we're full or when we're done */
|
||||
if (bzstream.avail_out == 0 ||
|
||||
(bzerr == BZ_STREAM_END && bzstream.avail_out != kNuGenCompBufSize))
|
||||
{
|
||||
DBUG(("+++ writing %d bytes\n",
|
||||
(uchar*)bzstream.next_out - outbuf));
|
||||
err = Nu_FWrite(fp, outbuf, (uchar*)bzstream.next_out - outbuf);
|
||||
if (err != kNuErrNone) {
|
||||
Nu_ReportError(NU_BLOB, err, "fwrite failed in bzip2");
|
||||
goto bz_bail;
|
||||
}
|
||||
|
||||
bzstream.next_out = outbuf;
|
||||
bzstream.avail_out = kNuGenCompBufSize;
|
||||
}
|
||||
} while (bzerr != BZ_STREAM_END);
|
||||
|
||||
*pDstLen = bzstream.total_out_lo32;
|
||||
Assert(bzstream.total_out_hi32 == 0); /* no huge files for us */
|
||||
|
||||
bz_bail:
|
||||
BZ2_bzCompressEnd(&bzstream); /* free up any allocated structures */
|
||||
|
||||
bail:
|
||||
if (outbuf != nil)
|
||||
free(outbuf);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ===========================================================================
|
||||
* Expansion
|
||||
* ===========================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* Expand from "infp" to "pFunnel".
|
||||
*/
|
||||
NuError
|
||||
Nu_ExpandBzip2(NuArchive* pArchive, const NuRecord* pRecord,
|
||||
const NuThread* pThread, FILE* infp, NuFunnel* pFunnel, ushort* pCrc)
|
||||
{
|
||||
NuError err = kNuErrNone;
|
||||
bz_stream bzstream;
|
||||
int bzerr;
|
||||
ulong compRemaining;
|
||||
uchar* outbuf;
|
||||
|
||||
Assert(pArchive != nil);
|
||||
Assert(pThread != nil);
|
||||
Assert(infp != nil);
|
||||
Assert(pFunnel != nil);
|
||||
|
||||
err = Nu_AllocCompressionBufferIFN(pArchive);
|
||||
if (err != kNuErrNone)
|
||||
return err;
|
||||
|
||||
/* allocate a similarly-sized buffer for the output */
|
||||
outbuf = Nu_Malloc(pArchive, kNuGenCompBufSize);
|
||||
BailAlloc(outbuf);
|
||||
|
||||
compRemaining = pThread->thCompThreadEOF;
|
||||
|
||||
/*
|
||||
* Initialize the libbz2 stream.
|
||||
*/
|
||||
bzstream.bzalloc = Nu_bzalloc;
|
||||
bzstream.bzfree = Nu_bzfree;
|
||||
bzstream.opaque = pArchive;
|
||||
bzstream.next_in = nil;
|
||||
bzstream.avail_in = 0;
|
||||
bzstream.next_out = outbuf;
|
||||
bzstream.avail_out = kNuGenCompBufSize;
|
||||
|
||||
/* third arg is "small" (set nonzero to reduce mem) */
|
||||
bzerr = BZ2_bzDecompressInit(&bzstream, kBZVerbosity, 0);
|
||||
if (bzerr != BZ_OK) {
|
||||
err = kNuErrInternal;
|
||||
if (bzerr == BZ_CONFIG_ERROR) {
|
||||
Nu_ReportError(NU_BLOB, err, "error configuring libbz2");
|
||||
} else {
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"call to BZ2_bzDecompressInit failed (bzerr=%d)", bzerr);
|
||||
}
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop while we have data.
|
||||
*/
|
||||
do {
|
||||
ulong getSize;
|
||||
|
||||
/* read as much as we can */
|
||||
if (bzstream.avail_in == 0) {
|
||||
getSize = (compRemaining > kNuGenCompBufSize) ?
|
||||
kNuGenCompBufSize : compRemaining;
|
||||
DBUG(("+++ reading %ld bytes (%ld left)\n", getSize,
|
||||
compRemaining));
|
||||
|
||||
err = Nu_FRead(infp, pArchive->compBuf, getSize);
|
||||
if (err != kNuErrNone) {
|
||||
Nu_ReportError(NU_BLOB, err, "bzip2 read failed");
|
||||
goto bz_bail;
|
||||
}
|
||||
|
||||
compRemaining -= getSize;
|
||||
|
||||
bzstream.next_in = pArchive->compBuf;
|
||||
bzstream.avail_in = getSize;
|
||||
}
|
||||
|
||||
/* uncompress the data */
|
||||
bzerr = BZ2_bzDecompress(&bzstream);
|
||||
if (bzerr != BZ_OK && bzerr != BZ_STREAM_END) {
|
||||
err = kNuErrInternal;
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"libbz2 decompress call failed (bzerr=%d)", bzerr);
|
||||
goto bz_bail;
|
||||
}
|
||||
|
||||
/* write every time there's anything (buffer will usually be full) */
|
||||
if (bzstream.avail_out != kNuGenCompBufSize) {
|
||||
DBUG(("+++ writing %d bytes\n",(uchar*)bzstream.next_out - outbuf));
|
||||
err = Nu_FunnelWrite(pArchive, pFunnel, outbuf,
|
||||
(uchar*)bzstream.next_out - outbuf);
|
||||
if (err != kNuErrNone) {
|
||||
Nu_ReportError(NU_BLOB, err, "write failed in inflate");
|
||||
goto bz_bail;
|
||||
}
|
||||
|
||||
if (pCrc != nil)
|
||||
*pCrc = Nu_CalcCRC16(*pCrc, outbuf,
|
||||
(uchar*) bzstream.next_out - outbuf);
|
||||
|
||||
bzstream.next_out = outbuf;
|
||||
bzstream.avail_out = kNuGenCompBufSize;
|
||||
}
|
||||
} while (bzerr == BZ_OK);
|
||||
|
||||
Assert(bzerr == BZ_STREAM_END); /* other errors should've been caught */
|
||||
|
||||
Assert(bzstream.total_out_hi32 == 0); /* no huge files for us */
|
||||
|
||||
if (bzstream.total_out_lo32 != pThread->actualThreadEOF) {
|
||||
err = kNuErrBadData;
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"size mismatch on expanded bzip2 file (%d vs %ld)",
|
||||
bzstream.total_out_lo32, pThread->actualThreadEOF);
|
||||
goto bz_bail;
|
||||
}
|
||||
|
||||
bz_bail:
|
||||
BZ2_bzDecompressEnd(&bzstream); /* free up any allocated structures */
|
||||
|
||||
bail:
|
||||
if (outbuf != nil)
|
||||
free(outbuf);
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif /*ENABLE_BZIP2*/
|
@ -183,10 +183,13 @@ Nu_CompressToArchive(NuArchive* pArchive, NuDataSource* pDataSource,
|
||||
err = Nu_CompressUncompressed(pArchive, pStraw, dstFp, srcLen,
|
||||
&dstLen, &threadCrc);
|
||||
break;
|
||||
#ifdef ENABLE_SQ
|
||||
case kNuThreadFormatHuffmanSQ:
|
||||
err = Nu_CompressHuffmanSQ(pArchive, pStraw, dstFp, srcLen,
|
||||
&dstLen, &threadCrc);
|
||||
break;
|
||||
#endif
|
||||
#ifdef ENABLE_LZW
|
||||
case kNuThreadFormatLZW1:
|
||||
err = Nu_CompressLZW1(pArchive, pStraw, dstFp, srcLen, &dstLen,
|
||||
&threadCrc);
|
||||
@ -195,6 +198,8 @@ Nu_CompressToArchive(NuArchive* pArchive, NuDataSource* pDataSource,
|
||||
err = Nu_CompressLZW2(pArchive, pStraw, dstFp, srcLen, &dstLen,
|
||||
&threadCrc);
|
||||
break;
|
||||
#endif
|
||||
#ifdef ENABLE_LZC
|
||||
case kNuThreadFormatLZC12:
|
||||
err = Nu_CompressLZC12(pArchive, pStraw, dstFp, srcLen, &dstLen,
|
||||
&threadCrc);
|
||||
@ -203,12 +208,19 @@ Nu_CompressToArchive(NuArchive* pArchive, NuDataSource* pDataSource,
|
||||
err = Nu_CompressLZC16(pArchive, pStraw, dstFp, srcLen, &dstLen,
|
||||
&threadCrc);
|
||||
break;
|
||||
#ifdef HAVE_LIBZ
|
||||
#endif
|
||||
#ifdef ENABLE_DEFLATE
|
||||
case kNuThreadFormatDeflate:
|
||||
err = Nu_CompressDeflate(pArchive, pStraw, dstFp, srcLen, &dstLen,
|
||||
&threadCrc);
|
||||
break;
|
||||
#endif
|
||||
#ifdef ENABLE_BZIP2
|
||||
case kNuThreadFormatBzip2:
|
||||
err = Nu_CompressBzip2(pArchive, pStraw, dstFp, srcLen, &dstLen,
|
||||
&threadCrc);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
/* should've been blocked in Value.c */
|
||||
Assert(0);
|
||||
|
@ -32,7 +32,8 @@ static const char* gThreadFormatNames[] = {
|
||||
"dynamic LZW/2",
|
||||
"12-bit LZC",
|
||||
"16-bit LZC",
|
||||
"deflate"
|
||||
"deflate",
|
||||
"bzip2"
|
||||
};
|
||||
|
||||
/* days of the week */
|
||||
|
@ -16,12 +16,7 @@
|
||||
*/
|
||||
#include "NufxLibPriv.h"
|
||||
|
||||
/*
|
||||
* Because of the lack of Apple II support, I'm making this feature optional
|
||||
* at compile time. The configure scripts will only define HAVE_LIBZ
|
||||
* if both the library and the header file can be found.
|
||||
*/
|
||||
#ifdef HAVE_LIBZ
|
||||
#ifdef ENABLE_DEFLATE
|
||||
#include "zlib.h"
|
||||
|
||||
#define kNuDeflateLevel 9 /* use maximum compression */
|
||||
@ -35,7 +30,7 @@ Nu_zalloc(voidpf opaque, uInt items, uInt size)
|
||||
{
|
||||
return Nu_Malloc(opaque, items * size);
|
||||
}
|
||||
void
|
||||
static void
|
||||
Nu_zfree(voidpf opaque, voidpf address)
|
||||
{
|
||||
return Nu_Free(opaque, address);
|
||||
@ -264,7 +259,7 @@ Nu_ExpandDeflate(NuArchive* pArchive, const NuRecord* pRecord,
|
||||
goto z_bail;
|
||||
}
|
||||
|
||||
/* write every time (buffer will usually be full) */
|
||||
/* write every time there's anything (buffer will usually be full) */
|
||||
if (zstream.avail_out != kNuGenCompBufSize) {
|
||||
DBUG(("+++ writing %d bytes\n", zstream.next_out - outbuf));
|
||||
err = Nu_FunnelWrite(pArchive, pFunnel, outbuf,
|
||||
@ -301,4 +296,4 @@ bail:
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif /*HAVE_LIBZ*/
|
||||
#endif /*ENABLE_DEFLATE*/
|
||||
|
@ -534,12 +534,6 @@ NuGetAttr(NuArchive* pArchive, NuAttrID ident, NuAttr* pAttr)
|
||||
return err;
|
||||
}
|
||||
|
||||
const char*
|
||||
NuStrError(NuError err)
|
||||
{
|
||||
return Nu_StrError(err);
|
||||
}
|
||||
|
||||
NuError
|
||||
NuDebugDumpArchive(NuArchive* pArchive)
|
||||
{
|
||||
@ -553,14 +547,6 @@ NuDebugDumpArchive(NuArchive* pArchive)
|
||||
#endif
|
||||
}
|
||||
|
||||
NuError
|
||||
NuGetVersion(long* pMajorVersion, long* pMinorVersion, long* pBugVersion,
|
||||
const char** ppBuildDate, const char** ppBuildFlags)
|
||||
{
|
||||
return Nu_GetVersion(pMajorVersion, pMinorVersion, pBugVersion,
|
||||
ppBuildDate, ppBuildFlags);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ===========================================================================
|
||||
@ -657,6 +643,59 @@ NuDataSinkGetOutCount(NuDataSink* pDataSink, ulong* pOutCount)
|
||||
* ===========================================================================
|
||||
*/
|
||||
|
||||
const char*
|
||||
NuStrError(NuError err)
|
||||
{
|
||||
return Nu_StrError(err);
|
||||
}
|
||||
|
||||
NuError
|
||||
NuGetVersion(long* pMajorVersion, long* pMinorVersion, long* pBugVersion,
|
||||
const char** ppBuildDate, const char** ppBuildFlags)
|
||||
{
|
||||
return Nu_GetVersion(pMajorVersion, pMinorVersion, pBugVersion,
|
||||
ppBuildDate, ppBuildFlags);
|
||||
}
|
||||
|
||||
NuError
|
||||
NuTestFeature(NuFeature feature)
|
||||
{
|
||||
NuError err = kNuErrUnsupFeature;
|
||||
|
||||
switch (feature) {
|
||||
case kNuFeatureCompressHuffmanSQ:
|
||||
#ifdef ENABLE_SQ
|
||||
err = kNuErrNone;
|
||||
#endif
|
||||
break;
|
||||
case kNuFeatureCompressLZW:
|
||||
#ifdef ENABLE_LZW
|
||||
err = kNuErrNone;
|
||||
#endif
|
||||
break;
|
||||
case kNuFeatureCompressLZC:
|
||||
#ifdef ENABLE_LZC
|
||||
err = kNuErrNone;
|
||||
#endif
|
||||
break;
|
||||
case kNuFeatureCompressDeflate:
|
||||
#ifdef ENABLE_DEFLATE
|
||||
err = kNuErrNone;
|
||||
#endif
|
||||
break;
|
||||
case kNuFeatureCompressBzip2:
|
||||
#ifdef ENABLE_BZIP2
|
||||
err = kNuErrNone;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
err = kNuErrUnknownFeature;
|
||||
break;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void
|
||||
NuRecordCopyAttr(NuRecordAttr* pRecordAttr, const NuRecord* pRecord)
|
||||
{
|
||||
|
@ -161,32 +161,40 @@ Nu_ExpandStream(NuArchive* pArchive, const NuRecord* pRecord,
|
||||
err = Nu_ExpandUncompressed(pArchive, pRecord, pThread, infp, pFunnel,
|
||||
pCalcCrc);
|
||||
break;
|
||||
#ifdef ENABLE_SQ
|
||||
case kNuThreadFormatHuffmanSQ:
|
||||
err = Nu_ExpandHuffmanSQ(pArchive, pRecord, pThread, infp, pFunnel,
|
||||
pCalcCrc);
|
||||
break;
|
||||
#endif
|
||||
#ifdef ENABLE_LZW
|
||||
case kNuThreadFormatLZW1:
|
||||
case kNuThreadFormatLZW2:
|
||||
err = Nu_ExpandLZW(pArchive, pRecord, pThread, infp, pFunnel, pCalcCrc);
|
||||
break;
|
||||
#endif
|
||||
#ifdef ENABLE_LZC
|
||||
case kNuThreadFormatLZC12:
|
||||
case kNuThreadFormatLZC16:
|
||||
err = Nu_ExpandLZC(pArchive, pRecord, pThread, infp, pFunnel, pCalcCrc);
|
||||
break;
|
||||
#endif
|
||||
#ifdef ENABLE_DEFLATE
|
||||
case kNuThreadFormatDeflate:
|
||||
#ifdef HAVE_LIBZ
|
||||
err = Nu_ExpandDeflate(pArchive, pRecord, pThread, infp, pFunnel,
|
||||
pCalcCrc);
|
||||
#else
|
||||
err = kNuErrBadFormat;
|
||||
Nu_ReportError(NU_BLOB, kNuErrNone,
|
||||
"deflate compression not supported");
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#ifdef ENABLE_BZIP2
|
||||
case kNuThreadFormatBzip2:
|
||||
err = Nu_ExpandBzip2(pArchive, pRecord, pThread, infp, pFunnel,
|
||||
pCalcCrc);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
err = kNuErrBadFormat;
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"format %u unknown", pThread->thThreadFormat);
|
||||
"compression format %u not supported", pThread->thThreadFormat);
|
||||
break;
|
||||
}
|
||||
BailError(err);
|
||||
|
@ -18,6 +18,8 @@
|
||||
*/
|
||||
#include "NufxLibPriv.h"
|
||||
|
||||
#ifdef ENABLE_LZC
|
||||
|
||||
#define DEBUG_LZC
|
||||
|
||||
/*
|
||||
@ -1098,3 +1100,4 @@ Nu_ExpandLZC(NuArchive* pArchive, const NuRecord* pRecord,
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif /*ENABLE_LZC*/
|
||||
|
@ -30,6 +30,8 @@
|
||||
*/
|
||||
#include "NufxLibPriv.h"
|
||||
|
||||
#ifdef ENABLE_LZW
|
||||
|
||||
/* the LZW algorithms operate on 4K chunks */
|
||||
#define kNuLZWBlockSize 4096
|
||||
|
||||
@ -1604,3 +1606,4 @@ bail:
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif /*ENABLE_LZW*/
|
||||
|
@ -26,14 +26,14 @@ OPT = @CFLAGS@
|
||||
GCC_FLAGS = -Wall -Wwrite-strings -Wstrict-prototypes -Wpointer-arith -Wshadow
|
||||
CFLAGS = @BUILD_FLAGS@ -I. @DEFS@
|
||||
|
||||
SRCS = Archive.c ArchiveIO.c Compress.c Crc16.c Debug.c Deferred.c \
|
||||
Deflate.c Entry.c Expand.c FileIO.c Funnel.c Lzc.c Lzw.c \
|
||||
MiscStuff.c MiscUtils.c Record.c SourceSink.c Squeeze.c \
|
||||
Thread.c Value.c Version.c
|
||||
OBJS = Archive.o ArchiveIO.o Compress.o Crc16.o Debug.o Deferred.o \
|
||||
Deflate.o Entry.o Expand.o FileIO.o Funnel.o Lzc.o Lzw.o \
|
||||
MiscStuff.o MiscUtils.o Record.o SourceSink.o Squeeze.o \
|
||||
Thread.o Value.o Version.o
|
||||
SRCS = Archive.c ArchiveIO.c Bzip2.c Compress.c Crc16.c Debug.c \
|
||||
Deferred.c Deflate.c Entry.c Expand.c FileIO.c Funnel.c \
|
||||
Lzc.c Lzw.c MiscStuff.c MiscUtils.c Record.c SourceSink.c \
|
||||
Squeeze.c Thread.c Value.c Version.c
|
||||
OBJS = Archive.o ArchiveIO.o Bzip2.o Compress.o Crc16.o Debug.o \
|
||||
Deferred.o Deflate.o Entry.o Expand.o FileIO.o Funnel.o \
|
||||
Lzc.o Lzw.o MiscStuff.o MiscUtils.o Record.o SourceSink.o \
|
||||
Squeeze.o Thread.o Value.o Version.o
|
||||
|
||||
STATIC_PRODUCT = libnufx.a
|
||||
SHARED_PRODUCT = libnufx.so
|
||||
|
@ -15,7 +15,7 @@
|
||||
NuCallback gNuGlobalErrorMessageHandler = nil;
|
||||
|
||||
|
||||
const char* kNufxLibName = "nufxlib";
|
||||
static const char* kNufxLibName = "nufxlib";
|
||||
|
||||
|
||||
/*
|
||||
@ -33,7 +33,9 @@ Nu_StrError(NuError err)
|
||||
*
|
||||
* An easier solution, should this present a problem for someone, would
|
||||
* be to have the function return nil or "unknown error" when the
|
||||
* error value isn't recognized.
|
||||
* error value isn't recognized. I'd recommend leaving it as-is for
|
||||
* debug builds, though, as it's helpful to know *which* error is not
|
||||
* recognized.
|
||||
*/
|
||||
static char defaultMsg[32];
|
||||
|
||||
@ -177,6 +179,11 @@ Nu_StrError(NuError err)
|
||||
case kNuErrIsBinary2:
|
||||
return "This is a Binary II archive";
|
||||
|
||||
case kNuErrUnknownFeature:
|
||||
return "Unknown feature";
|
||||
case kNuErrUnsupFeature:
|
||||
return "Feature not supported";
|
||||
|
||||
default:
|
||||
sprintf(defaultMsg, "(error=%d)", err);
|
||||
return defaultMsg;
|
||||
|
@ -104,6 +104,9 @@ typedef enum NuError {
|
||||
kNuErrDamaged = -83, /* original archive may have been damaged */
|
||||
|
||||
kNuErrIsBinary2 = -90, /* this looks like a Binary II archive */
|
||||
|
||||
kNuErrUnknownFeature =-100, /* attempt to test unknown feature */
|
||||
kNuErrUnsupFeature = -101, /* feature not supported */
|
||||
} NuError;
|
||||
|
||||
/*
|
||||
@ -168,6 +171,7 @@ typedef enum NuThreadFormat {
|
||||
kNuThreadFormatLZC12 = 0x0004,
|
||||
kNuThreadFormatLZC16 = 0x0005,
|
||||
kNuThreadFormatDeflate = 0x0006, /* NOTE: not in NuFX standard */
|
||||
kNuThreadFormatBzip2 = 0x0007, /* NOTE: not in NuFX standard */
|
||||
} NuThreadFormat;
|
||||
|
||||
|
||||
@ -258,6 +262,7 @@ enum NuValueValue {
|
||||
kNuCompressLZC12 = 14,
|
||||
kNuCompressLZC16 = 15,
|
||||
kNuCompressDeflate = 16,
|
||||
kNuCompressBzip2 = 17,
|
||||
|
||||
/* for kNuValueEOL */
|
||||
kNuEOLUnknown = 50,
|
||||
@ -624,6 +629,20 @@ typedef struct NuErrorMessage {
|
||||
} NuErrorMessage;
|
||||
|
||||
|
||||
/*
|
||||
* Options for the NuTestFeature function.
|
||||
*/
|
||||
typedef enum NuFeature {
|
||||
kNuFeatureUnknown = 0,
|
||||
|
||||
kNuFeatureCompressHuffmanSQ = 1, /* kNuThreadFormatHuffmanSQ */
|
||||
kNuFeatureCompressLZW = 2, /* kNuThreadFormatLZW1 and LZW2 */
|
||||
kNuFeatureCompressLZC = 3, /* kNuThreadFormatLZC12 and LZC16 */
|
||||
kNuFeatureCompressDeflate = 4, /* kNuThreadFormatDeflate */
|
||||
kNuFeatureCompressBzip2 = 5, /* kNuThreadFormatBzip2 */
|
||||
} NuFeature;
|
||||
|
||||
|
||||
/*
|
||||
* ===========================================================================
|
||||
* Function prototypes
|
||||
@ -680,10 +699,6 @@ NuError NuSetExtraData(NuArchive* pArchive, void* pData);
|
||||
NuError NuGetValue(NuArchive* pArchive, NuValueID ident, NuValue* pValue);
|
||||
NuError NuSetValue(NuArchive* pArchive, NuValueID ident, NuValue value);
|
||||
NuError NuGetAttr(NuArchive* pArchive, NuAttrID ident, NuAttr* pAttr);
|
||||
NuError NuGetVersion(long* pMajorVersion, long* pMinorVersion,
|
||||
long* pBugVersion, const char** ppBuildDate,
|
||||
const char** ppBuildFlags);
|
||||
const char* NuStrError(NuError err);
|
||||
NuError NuDebugDumpArchive(NuArchive* pArchive);
|
||||
|
||||
/* sources and sinks */
|
||||
@ -709,6 +724,11 @@ NuError NuFreeDataSink(NuDataSink* pDataSink);
|
||||
NuError NuDataSinkGetOutCount(NuDataSink* pDataSink, unsigned long* pOutCount);
|
||||
|
||||
/* miscellaneous non-archive operations */
|
||||
NuError NuGetVersion(long* pMajorVersion, long* pMinorVersion,
|
||||
long* pBugVersion, const char** ppBuildDate,
|
||||
const char** ppBuildFlags);
|
||||
const char* NuStrError(NuError err);
|
||||
NuError NuTestFeature(NuFeature feature);
|
||||
void NuRecordCopyAttr(NuRecordAttr* pRecordAttr, const NuRecord* pRecord);
|
||||
NuError NuRecordCopyThreads(const NuRecord* pRecord, NuThread** ppThreads);
|
||||
unsigned long NuRecordGetNumThreads(const NuRecord* pRecord);
|
||||
|
@ -522,6 +522,12 @@ NuError Nu_SeekArchive(NuArchive* pArchive, FILE* fp, long offset,
|
||||
int ptrname);
|
||||
NuError Nu_RewindArchive(NuArchive* pArchive);
|
||||
|
||||
/* Bzip2.c */
|
||||
NuError Nu_CompressBzip2(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
|
||||
ulong srcLen, ulong* pDstLen, ushort* pCrc);
|
||||
NuError Nu_ExpandBzip2(NuArchive* pArchive, const NuRecord* pRecord,
|
||||
const NuThread* pThread, FILE* infp, NuFunnel* pFunnel, ushort* pCrc);
|
||||
|
||||
/* Compress.c */
|
||||
NuError Nu_CompressToArchive(NuArchive* pArchive, NuDataSource* pDataSource,
|
||||
NuThreadID threadID, NuThreadFormat sourceFormat,
|
||||
|
@ -11,6 +11,10 @@ Run the "configure" script. Read through "INSTALL" if you haven't used
|
||||
one of these before, especially if you want to use a specific compiler
|
||||
or a particular set of compiler flags.
|
||||
|
||||
You can disable specific compression methods with "--disable-METHOD"
|
||||
(run "sh ./configure --help" to see the possible options). By default,
|
||||
all methods are enabled except bzip2.
|
||||
|
||||
Run "make depend" if you have makedepend, and then type "make". This will
|
||||
build the library and all of the programs in the "samples" directory.
|
||||
There are some useful programs in "samples", described in a README.txt
|
||||
|
@ -32,6 +32,7 @@
|
||||
*/
|
||||
#include "NufxLibPriv.h"
|
||||
|
||||
#ifdef ENABLE_SQ
|
||||
|
||||
/* if this is defined, create and unpack the full SQ header (debugging only) */
|
||||
/* #define FULL_SQ_HEADER */
|
||||
@ -274,7 +275,7 @@ bail:
|
||||
/*
|
||||
* Return the greater of two integers.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
Nu_SQMax(int a, int b)
|
||||
{
|
||||
if (a > b)
|
||||
@ -364,7 +365,7 @@ Nu_SQHeap(SQState* pSqState, int list[], int length)
|
||||
* moving the last element over the top element and
|
||||
* reheaping the shorter list.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
Nu_SQBuildTree(SQState* pSqState, int list[], int len)
|
||||
{
|
||||
int freenode; /* next free node in tree */
|
||||
@ -421,7 +422,7 @@ Nu_SQBuildTree(SQState* pSqState, int list[], int len)
|
||||
*
|
||||
* Returns zero on success, nonzero if codes are too long.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
Nu_SQBuildEncTable(SQState* pSqState, int level, int root)
|
||||
{
|
||||
int l, r;
|
||||
@ -1141,3 +1142,4 @@ bail:
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif /*ENABLE_SQ*/
|
||||
|
@ -74,7 +74,7 @@ Nu_SetValue(NuArchive* pArchive, NuValueID ident, NuValue value)
|
||||
case kNuValueAllowDuplicates:
|
||||
if (value != true && value != false) {
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"Invalid kNuValueAllowDuplicates value %ld\n", value);
|
||||
"Invalid kNuValueAllowDuplicates value %ld", value);
|
||||
goto bail;
|
||||
}
|
||||
pArchive->valAllowDuplicates = value;
|
||||
@ -82,15 +82,15 @@ Nu_SetValue(NuArchive* pArchive, NuValueID ident, NuValue value)
|
||||
case kNuValueConvertExtractedEOL:
|
||||
if (value < kNuConvertOff || value > kNuConvertAuto) {
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"Invalid kNuValueConvertExtractedEOL value %ld\n", value);
|
||||
"Invalid kNuValueConvertExtractedEOL value %ld", value);
|
||||
goto bail;
|
||||
}
|
||||
pArchive->valConvertExtractedEOL = value;
|
||||
break;
|
||||
case kNuValueDataCompression:
|
||||
if (value < kNuCompressNone || value > kNuCompressDeflate) {
|
||||
if (value < kNuCompressNone || value > kNuCompressBzip2) {
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"Invalid kNuValueDataCompression value %ld\n", value);
|
||||
"Invalid kNuValueDataCompression value %ld", value);
|
||||
goto bail;
|
||||
}
|
||||
pArchive->valDataCompression = value;
|
||||
@ -98,7 +98,7 @@ Nu_SetValue(NuArchive* pArchive, NuValueID ident, NuValue value)
|
||||
case kNuValueDiscardWrapper:
|
||||
if (value != true && value != false) {
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"Invalid kNuValueDiscardWrapper value %ld\n", value);
|
||||
"Invalid kNuValueDiscardWrapper value %ld", value);
|
||||
goto bail;
|
||||
}
|
||||
pArchive->valDiscardWrapper = value;
|
||||
@ -106,7 +106,7 @@ Nu_SetValue(NuArchive* pArchive, NuValueID ident, NuValue value)
|
||||
case kNuValueEOL:
|
||||
if (value < kNuEOLUnknown || value > kNuEOLCRLF) {
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"Invalid kNuValueEOL value %ld\n", value);
|
||||
"Invalid kNuValueEOL value %ld", value);
|
||||
goto bail;
|
||||
}
|
||||
pArchive->valEOL = value;
|
||||
@ -114,7 +114,7 @@ Nu_SetValue(NuArchive* pArchive, NuValueID ident, NuValue value)
|
||||
case kNuValueHandleExisting:
|
||||
if (value < kNuMaybeOverwrite || value > kNuMustOverwrite) {
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"Invalid kNuValueHandleExisting value %ld\n", value);
|
||||
"Invalid kNuValueHandleExisting value %ld", value);
|
||||
goto bail;
|
||||
}
|
||||
pArchive->valHandleExisting = value;
|
||||
@ -122,7 +122,7 @@ Nu_SetValue(NuArchive* pArchive, NuValueID ident, NuValue value)
|
||||
case kNuValueIgnoreCRC:
|
||||
if (value != true && value != false) {
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"Invalid kNuValueIgnoreCRC value %ld\n", value);
|
||||
"Invalid kNuValueIgnoreCRC value %ld", value);
|
||||
goto bail;
|
||||
}
|
||||
pArchive->valIgnoreCRC = value;
|
||||
@ -130,7 +130,7 @@ Nu_SetValue(NuArchive* pArchive, NuValueID ident, NuValue value)
|
||||
case kNuValueMimicSHK:
|
||||
if (value != true && value != false) {
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"Invalid kNuValueMimicSHK value %ld\n", value);
|
||||
"Invalid kNuValueMimicSHK value %ld", value);
|
||||
goto bail;
|
||||
}
|
||||
pArchive->valMimicSHK = value;
|
||||
@ -138,7 +138,7 @@ Nu_SetValue(NuArchive* pArchive, NuValueID ident, NuValue value)
|
||||
case kNuValueModifyOrig:
|
||||
if (value != true && value != false) {
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"Invalid kNuValueModifyOrig value %ld\n", value);
|
||||
"Invalid kNuValueModifyOrig value %ld", value);
|
||||
goto bail;
|
||||
}
|
||||
pArchive->valModifyOrig = value;
|
||||
@ -146,7 +146,7 @@ Nu_SetValue(NuArchive* pArchive, NuValueID ident, NuValue value)
|
||||
case kNuValueOnlyUpdateOlder:
|
||||
if (value != true && value != false) {
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"Invalid kNuValueOnlyUpdateOlder value %ld\n", value);
|
||||
"Invalid kNuValueOnlyUpdateOlder value %ld", value);
|
||||
goto bail;
|
||||
}
|
||||
pArchive->valOnlyUpdateOlder = value;
|
||||
@ -205,27 +205,58 @@ Nu_ConvertCompressValToFormat(NuArchive* pArchive, NuValue compValue)
|
||||
|
||||
switch (compValue) {
|
||||
case kNuCompressNone: threadFormat = kNuThreadFormatUncompressed; break;
|
||||
|
||||
#ifdef ENABLE_SQ
|
||||
case kNuCompressSQ: threadFormat = kNuThreadFormatHuffmanSQ; break;
|
||||
#else
|
||||
case kNuCompressSQ: threadFormat = kNuThreadFormatHuffmanSQ;
|
||||
unsup = true; break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_LZW
|
||||
case kNuCompressLZW1: threadFormat = kNuThreadFormatLZW1; break;
|
||||
case kNuCompressLZW2: threadFormat = kNuThreadFormatLZW2; break;
|
||||
case kNuCompressSQ: threadFormat = kNuThreadFormatHuffmanSQ; break;
|
||||
#else
|
||||
case kNuCompressLZW1: threadFormat = kNuThreadFormatLZW1;
|
||||
unsup = true; break;
|
||||
case kNuCompressLZW2: threadFormat = kNuThreadFormatLZW2;
|
||||
unsup = true; break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_LZC
|
||||
case kNuCompressLZC12: threadFormat = kNuThreadFormatLZC12; break;
|
||||
case kNuCompressLZC16: threadFormat = kNuThreadFormatLZC16; break;
|
||||
#ifdef HAVE_LIBZ
|
||||
#else
|
||||
case kNuCompressLZC12: threadFormat = kNuThreadFormatLZC12;
|
||||
unsup = true; break;
|
||||
case kNuCompressLZC16: threadFormat = kNuThreadFormatLZC16;
|
||||
unsup = true; break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_DEFLATE
|
||||
case kNuCompressDeflate: threadFormat = kNuThreadFormatDeflate; break;
|
||||
#else
|
||||
case kNuCompressDeflate: threadFormat = kNuThreadFormatDeflate;
|
||||
unsup = true; break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_BZIP2
|
||||
case kNuCompressBzip2: threadFormat = kNuThreadFormatBzip2; break;
|
||||
#else
|
||||
case kNuCompressBzip2: threadFormat = kNuThreadFormatBzip2;
|
||||
unsup = true; break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
Assert(false);
|
||||
Nu_ReportError(NU_BLOB, kNuErrInvalidArg,
|
||||
"Unknown compress value %ld", compValue);
|
||||
Assert(false);
|
||||
return kNuThreadFormatUncompressed;
|
||||
}
|
||||
|
||||
if (unsup) {
|
||||
Nu_ReportError(NU_BLOB, kNuErrNone,
|
||||
"Unsupported compression type 0x%04x requested (%ld), using none",
|
||||
"Unsupported compression type 0x%04x requested (%ld), not compressing",
|
||||
threadFormat, compValue);
|
||||
return kNuThreadFormatUncompressed;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
/* config.h.in. */
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
@ -120,9 +120,21 @@
|
||||
/* Define if VSNPRINTF is declared in stdio.h. */
|
||||
#undef VSNPRINTF_DECLARED
|
||||
|
||||
/* Define if you have libz.a or libz.so */
|
||||
#undef HAVE_LIBZ
|
||||
/* Define to include SQ (Huffman+RLE) compression. */
|
||||
#undef ENABLE_SQ
|
||||
|
||||
/* Define if we want to use the dmalloc library (--enable-dmalloc). */
|
||||
/* Define to include LZW (ShrinkIt LZW/1 and LZW/2) compression. */
|
||||
#undef ENABLE_LZW
|
||||
|
||||
/* Define to include LZC (12-bit and 16-bit UNIX "compress") compression. */
|
||||
#undef ENABLE_LZC
|
||||
|
||||
/* Define to include deflate (zlib) compression (also need -l in Makefile). */
|
||||
#undef ENABLE_DEFLATE
|
||||
|
||||
/* Define to include bzip2 (libbz2) compression (also need -l in Makefile). */
|
||||
#undef ENABLE_BZIP2
|
||||
|
||||
/* Define if we want to use the dmalloc library (also need -l in Makefile). */
|
||||
#undef USE_DMALLOC
|
||||
|
||||
|
440
nufxlib-0/configure
vendored
440
nufxlib-0/configure
vendored
@ -12,7 +12,17 @@ ac_help=
|
||||
ac_default_prefix=/usr/local
|
||||
# Any additions from configure.in:
|
||||
ac_help="$ac_help
|
||||
--enable-dmalloc: do dmalloc stuff"
|
||||
--disable-sq disable SQ compression"
|
||||
ac_help="$ac_help
|
||||
--disable-lzw disable LZW/1 and LZW/2 compression"
|
||||
ac_help="$ac_help
|
||||
--disable-lzc disable 12- and 16-bit LZC compression"
|
||||
ac_help="$ac_help
|
||||
--disable-deflate disable zlib deflate compression"
|
||||
ac_help="$ac_help
|
||||
--enable-bzip2 enable libbz2 bzip2 compression"
|
||||
ac_help="$ac_help
|
||||
--enable-dmalloc do dmalloc stuff"
|
||||
|
||||
# Initialize some variables set by options.
|
||||
# The variables have the same names as the options, with
|
||||
@ -551,7 +561,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
|
||||
fi
|
||||
|
||||
echo $ac_n "checking host system type""... $ac_c" 1>&6
|
||||
echo "configure:555: checking host system type" >&5
|
||||
echo "configure:565: checking host system type" >&5
|
||||
|
||||
host_alias=$host
|
||||
case "$host_alias" in
|
||||
@ -574,7 +584,7 @@ echo "$ac_t""$host" 1>&6
|
||||
# Extract the first word of "gcc", so it can be a program name with args.
|
||||
set dummy gcc; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:578: checking for $ac_word" >&5
|
||||
echo "configure:588: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -604,7 +614,7 @@ if test -z "$CC"; then
|
||||
# Extract the first word of "cc", so it can be a program name with args.
|
||||
set dummy cc; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:608: checking for $ac_word" >&5
|
||||
echo "configure:618: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -655,7 +665,7 @@ fi
|
||||
# Extract the first word of "cl", so it can be a program name with args.
|
||||
set dummy cl; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:659: checking for $ac_word" >&5
|
||||
echo "configure:669: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -687,7 +697,7 @@ fi
|
||||
fi
|
||||
|
||||
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
|
||||
echo "configure:691: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
|
||||
echo "configure:701: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
|
||||
|
||||
ac_ext=c
|
||||
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
|
||||
@ -698,12 +708,12 @@ cross_compiling=$ac_cv_prog_cc_cross
|
||||
|
||||
cat > conftest.$ac_ext << EOF
|
||||
|
||||
#line 702 "configure"
|
||||
#line 712 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
main(){return(0);}
|
||||
EOF
|
||||
if { (eval echo configure:707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
ac_cv_prog_cc_works=yes
|
||||
# If we can't run a trivial program, we are probably using a cross compiler.
|
||||
if (./conftest; exit) 2>/dev/null; then
|
||||
@ -729,12 +739,12 @@ if test $ac_cv_prog_cc_works = no; then
|
||||
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
|
||||
fi
|
||||
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
|
||||
echo "configure:733: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
|
||||
echo "configure:743: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
|
||||
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
|
||||
cross_compiling=$ac_cv_prog_cc_cross
|
||||
|
||||
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
|
||||
echo "configure:738: checking whether we are using GNU C" >&5
|
||||
echo "configure:748: checking whether we are using GNU C" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -743,7 +753,7 @@ else
|
||||
yes;
|
||||
#endif
|
||||
EOF
|
||||
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:747: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
|
||||
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:757: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
|
||||
ac_cv_prog_gcc=yes
|
||||
else
|
||||
ac_cv_prog_gcc=no
|
||||
@ -762,7 +772,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS=
|
||||
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
|
||||
echo "configure:766: checking whether ${CC-cc} accepts -g" >&5
|
||||
echo "configure:776: checking whether ${CC-cc} accepts -g" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -805,7 +815,7 @@ fi
|
||||
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
|
||||
# ./install, which can be erroneously created by make from ./install.sh.
|
||||
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
|
||||
echo "configure:809: checking for a BSD compatible install" >&5
|
||||
echo "configure:819: checking for a BSD compatible install" >&5
|
||||
if test -z "$INSTALL"; then
|
||||
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@ -858,7 +868,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
|
||||
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
|
||||
|
||||
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
|
||||
echo "configure:862: checking whether ${MAKE-make} sets \${MAKE}" >&5
|
||||
echo "configure:872: checking whether ${MAKE-make} sets \${MAKE}" >&5
|
||||
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@ -887,7 +897,7 @@ fi
|
||||
# Extract the first word of "ranlib", so it can be a program name with args.
|
||||
set dummy ranlib; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:891: checking for $ac_word" >&5
|
||||
echo "configure:901: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -916,7 +926,7 @@ fi
|
||||
|
||||
|
||||
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
|
||||
echo "configure:920: checking how to run the C preprocessor" >&5
|
||||
echo "configure:930: checking how to run the C preprocessor" >&5
|
||||
# On Suns, sometimes $CPP names a directory.
|
||||
if test -n "$CPP" && test -d "$CPP"; then
|
||||
CPP=
|
||||
@ -931,13 +941,13 @@ else
|
||||
# On the NeXT, cc -E runs the code through the compiler's parser,
|
||||
# not just through cpp.
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 935 "configure"
|
||||
#line 945 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <assert.h>
|
||||
Syntax Error
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:941: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:951: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
:
|
||||
@ -948,13 +958,13 @@ else
|
||||
rm -rf conftest*
|
||||
CPP="${CC-cc} -E -traditional-cpp"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 952 "configure"
|
||||
#line 962 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <assert.h>
|
||||
Syntax Error
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:958: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
:
|
||||
@ -965,13 +975,13 @@ else
|
||||
rm -rf conftest*
|
||||
CPP="${CC-cc} -nologo -E"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 969 "configure"
|
||||
#line 979 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <assert.h>
|
||||
Syntax Error
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:975: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
:
|
||||
@ -1000,17 +1010,17 @@ for ac_hdr in fcntl.h malloc.h stdlib.h sys/stat.h sys/time.h sys/types.h \
|
||||
do
|
||||
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
|
||||
echo "configure:1004: checking for $ac_hdr" >&5
|
||||
echo "configure:1014: checking for $ac_hdr" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1009 "configure"
|
||||
#line 1019 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <$ac_hdr>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:1014: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:1024: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
@ -1038,89 +1048,14 @@ done
|
||||
|
||||
|
||||
LIBS=""
|
||||
echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6
|
||||
echo "configure:1043: checking for deflate in -lz" >&5
|
||||
ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lz $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1051 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char deflate();
|
||||
|
||||
int main() {
|
||||
deflate()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=no"
|
||||
fi
|
||||
rm -f conftest*
|
||||
LIBS="$ac_save_LIBS"
|
||||
|
||||
fi
|
||||
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
ac_safe=`echo "zlib.h" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for zlib.h""... $ac_c" 1>&6
|
||||
echo "configure:1079: checking for zlib.h" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1084 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <zlib.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:1089: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_header_$ac_safe=yes"
|
||||
else
|
||||
echo "$ac_err" >&5
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_header_$ac_safe=no"
|
||||
fi
|
||||
rm -f conftest*
|
||||
fi
|
||||
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define HAVE_LIBZ 1
|
||||
EOF
|
||||
LIBS="$LIBS -lz"
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
|
||||
echo $ac_n "checking for working const""... $ac_c" 1>&6
|
||||
echo "configure:1119: checking for working const" >&5
|
||||
echo "configure:1054: checking for working const" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1124 "configure"
|
||||
#line 1059 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
int main() {
|
||||
@ -1169,7 +1104,7 @@ ccp = (char const *const *) p;
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:1108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
ac_cv_c_const=yes
|
||||
else
|
||||
@ -1190,21 +1125,21 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for inline""... $ac_c" 1>&6
|
||||
echo "configure:1194: checking for inline" >&5
|
||||
echo "configure:1129: checking for inline" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_cv_c_inline=no
|
||||
for ac_kw in inline __inline__ __inline; do
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1201 "configure"
|
||||
#line 1136 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
int main() {
|
||||
} $ac_kw foo() {
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1208: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:1143: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
ac_cv_c_inline=$ac_kw; break
|
||||
else
|
||||
@ -1230,12 +1165,12 @@ EOF
|
||||
esac
|
||||
|
||||
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
|
||||
echo "configure:1234: checking for ANSI C header files" >&5
|
||||
echo "configure:1169: checking for ANSI C header files" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1239 "configure"
|
||||
#line 1174 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
@ -1243,7 +1178,7 @@ else
|
||||
#include <float.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:1247: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:1182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
@ -1260,7 +1195,7 @@ rm -f conftest*
|
||||
if test $ac_cv_header_stdc = yes; then
|
||||
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1264 "configure"
|
||||
#line 1199 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <string.h>
|
||||
EOF
|
||||
@ -1278,7 +1213,7 @@ fi
|
||||
if test $ac_cv_header_stdc = yes; then
|
||||
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1282 "configure"
|
||||
#line 1217 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <stdlib.h>
|
||||
EOF
|
||||
@ -1299,7 +1234,7 @@ if test "$cross_compiling" = yes; then
|
||||
:
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1303 "configure"
|
||||
#line 1238 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <ctype.h>
|
||||
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
|
||||
@ -1310,7 +1245,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
|
||||
exit (0); }
|
||||
|
||||
EOF
|
||||
if { (eval echo configure:1314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
if { (eval echo configure:1249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
then
|
||||
:
|
||||
else
|
||||
@ -1334,12 +1269,12 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for mode_t""... $ac_c" 1>&6
|
||||
echo "configure:1338: checking for mode_t" >&5
|
||||
echo "configure:1273: checking for mode_t" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1343 "configure"
|
||||
#line 1278 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
@ -1367,12 +1302,12 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for off_t""... $ac_c" 1>&6
|
||||
echo "configure:1371: checking for off_t" >&5
|
||||
echo "configure:1306: checking for off_t" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1376 "configure"
|
||||
#line 1311 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
@ -1400,12 +1335,12 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for size_t""... $ac_c" 1>&6
|
||||
echo "configure:1404: checking for size_t" >&5
|
||||
echo "configure:1339: checking for size_t" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1409 "configure"
|
||||
#line 1344 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
@ -1433,12 +1368,12 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
|
||||
echo "configure:1437: checking whether struct tm is in sys/time.h or time.h" >&5
|
||||
echo "configure:1372: checking whether struct tm is in sys/time.h or time.h" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1442 "configure"
|
||||
#line 1377 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
@ -1446,7 +1381,7 @@ int main() {
|
||||
struct tm *tp; tp->tm_sec;
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1450: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:1385: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
ac_cv_struct_tm=time.h
|
||||
else
|
||||
@ -1467,12 +1402,12 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for uchar""... $ac_c" 1>&6
|
||||
echo "configure:1471: checking for uchar" >&5
|
||||
echo "configure:1406: checking for uchar" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_uchar'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1476 "configure"
|
||||
#line 1411 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
@ -1500,12 +1435,12 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for ushort""... $ac_c" 1>&6
|
||||
echo "configure:1504: checking for ushort" >&5
|
||||
echo "configure:1439: checking for ushort" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_ushort'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1509 "configure"
|
||||
#line 1444 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
@ -1533,12 +1468,12 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for uint""... $ac_c" 1>&6
|
||||
echo "configure:1537: checking for uint" >&5
|
||||
echo "configure:1472: checking for uint" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_uint'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1542 "configure"
|
||||
#line 1477 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
@ -1566,12 +1501,12 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for ulong""... $ac_c" 1>&6
|
||||
echo "configure:1570: checking for ulong" >&5
|
||||
echo "configure:1505: checking for ulong" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_ulong'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1575 "configure"
|
||||
#line 1510 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
@ -1603,12 +1538,12 @@ for ac_func in fdopen ftruncate memmove mkdir mkstemp mktime timelocal \
|
||||
localtime_r snprintf strcasecmp strncasecmp strtoul strerror vsnprintf
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:1607: checking for $ac_func" >&5
|
||||
echo "configure:1542: checking for $ac_func" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1612 "configure"
|
||||
#line 1547 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -1631,7 +1566,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:1570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
@ -1657,13 +1592,13 @@ done
|
||||
|
||||
|
||||
echo $ac_n "checking if snprintf is declared""... $ac_c" 1>&6
|
||||
echo "configure:1661: checking if snprintf is declared" >&5
|
||||
echo "configure:1596: checking if snprintf is declared" >&5
|
||||
if eval "test \"`echo '$''{'nufxlib_cv_snprintf_in_header'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1667 "configure"
|
||||
#line 1602 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <stdio.h>
|
||||
EOF
|
||||
@ -1689,13 +1624,13 @@ fi
|
||||
echo "$ac_t""$nufxlib_cv_snprintf_in_header" 1>&6
|
||||
|
||||
echo $ac_n "checking if vsnprintf is declared""... $ac_c" 1>&6
|
||||
echo "configure:1693: checking if vsnprintf is declared" >&5
|
||||
echo "configure:1628: checking if vsnprintf is declared" >&5
|
||||
if eval "test \"`echo '$''{'nufxlib_cv_vsnprintf_in_header'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1699 "configure"
|
||||
#line 1634 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <stdio.h>
|
||||
EOF
|
||||
@ -1763,7 +1698,7 @@ if test "$host_os" = "beos"; then
|
||||
fi
|
||||
|
||||
echo $ac_n "checking if sprintf returns int""... $ac_c" 1>&6
|
||||
echo "configure:1767: checking if sprintf returns int" >&5
|
||||
echo "configure:1702: checking if sprintf returns int" >&5
|
||||
if eval "test \"`echo '$''{'nufxlib_cv_sprintf_returns_int'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -1772,7 +1707,7 @@ else
|
||||
nufxlib_cv_sprintf_returns_int=no
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1776 "configure"
|
||||
#line 1711 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@ -1785,7 +1720,7 @@ else
|
||||
}
|
||||
|
||||
EOF
|
||||
if { (eval echo configure:1789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
if { (eval echo configure:1724: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
then
|
||||
nufxlib_cv_sprintf_returns_int=yes
|
||||
else
|
||||
@ -1808,12 +1743,229 @@ EOF
|
||||
fi
|
||||
echo "$ac_t""$nufxlib_cv_sprintf_returns_int" 1>&6
|
||||
|
||||
DMALLOC=
|
||||
|
||||
# Check whether --enable-sq or --disable-sq was given.
|
||||
if test "${enable_sq+set}" = set; then
|
||||
enableval="$enable_sq"
|
||||
|
||||
else
|
||||
enable_sq=yes
|
||||
fi
|
||||
|
||||
if test $enable_sq = "yes"; then
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define ENABLE_SQ 1
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
# Check whether --enable-lzw or --disable-lzw was given.
|
||||
if test "${enable_lzw+set}" = set; then
|
||||
enableval="$enable_lzw"
|
||||
|
||||
else
|
||||
enable_lzw=yes
|
||||
fi
|
||||
|
||||
if test $enable_lzw = "yes"; then
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define ENABLE_LZW 1
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
# Check whether --enable-lzc or --disable-lzc was given.
|
||||
if test "${enable_lzc+set}" = set; then
|
||||
enableval="$enable_lzc"
|
||||
|
||||
else
|
||||
enable_lzc=yes
|
||||
fi
|
||||
|
||||
if test $enable_lzc = "yes"; then
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define ENABLE_LZC 1
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
# Check whether --enable-deflate or --disable-deflate was given.
|
||||
if test "${enable_deflate+set}" = set; then
|
||||
enableval="$enable_deflate"
|
||||
|
||||
else
|
||||
enable_deflate=yes
|
||||
fi
|
||||
|
||||
if test $enable_deflate = "yes"; then
|
||||
echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6
|
||||
echo "configure:1803: checking for deflate in -lz" >&5
|
||||
ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lz $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1811 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char deflate();
|
||||
|
||||
int main() {
|
||||
deflate()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=no"
|
||||
fi
|
||||
rm -f conftest*
|
||||
LIBS="$ac_save_LIBS"
|
||||
|
||||
fi
|
||||
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
ac_safe=`echo "zlib.h" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for zlib.h""... $ac_c" 1>&6
|
||||
echo "configure:1839: checking for zlib.h" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1844 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <zlib.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:1849: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_header_$ac_safe=yes"
|
||||
else
|
||||
echo "$ac_err" >&5
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_header_$ac_safe=no"
|
||||
fi
|
||||
rm -f conftest*
|
||||
fi
|
||||
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define ENABLE_DEFLATE 1
|
||||
EOF
|
||||
LIBS="$LIBS -lz"
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Check whether --enable-bzip2 or --disable-bzip2 was given.
|
||||
if test "${enable_bzip2+set}" = set; then
|
||||
enableval="$enable_bzip2"
|
||||
|
||||
else
|
||||
enable_bzip2=no
|
||||
fi
|
||||
|
||||
if test $enable_bzip2 = "yes"; then
|
||||
echo $ac_n "checking for BZ2_bzCompress in -lbz2""... $ac_c" 1>&6
|
||||
echo "configure:1889: checking for BZ2_bzCompress in -lbz2" >&5
|
||||
ac_lib_var=`echo bz2'_'BZ2_bzCompress | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lbz2 $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1897 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char BZ2_bzCompress();
|
||||
|
||||
int main() {
|
||||
BZ2_bzCompress()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=no"
|
||||
fi
|
||||
rm -f conftest*
|
||||
LIBS="$ac_save_LIBS"
|
||||
|
||||
fi
|
||||
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
ac_safe=`echo "bzlib.h" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for bzlib.h""... $ac_c" 1>&6
|
||||
echo "configure:1925: checking for bzlib.h" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1930 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <bzlib.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:1935: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_header_$ac_safe=yes"
|
||||
else
|
||||
echo "$ac_err" >&5
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_header_$ac_safe=no"
|
||||
fi
|
||||
rm -f conftest*
|
||||
fi
|
||||
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define ENABLE_BZIP2 1
|
||||
EOF
|
||||
LIBS="$LIBS -lbz2"
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-dmalloc or --disable-dmalloc was given.
|
||||
if test "${enable_dmalloc+set}" = set; then
|
||||
enableval="$enable_dmalloc"
|
||||
\
|
||||
echo "--- enabling dmalloc"; \
|
||||
echo "--- enabling dmalloc";
|
||||
LIBS="$LIBS -L/usr/local/lib -ldmalloc"; cat >> confdefs.h <<\EOF
|
||||
#define USE_DMALLOC 1
|
||||
EOF
|
||||
@ -1821,7 +1973,6 @@ EOF
|
||||
fi
|
||||
|
||||
|
||||
|
||||
trap '' 1 2 15
|
||||
cat > confcache <<\EOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
@ -1969,7 +2120,6 @@ s%@RANLIB@%$RANLIB%g
|
||||
s%@CPP@%$CPP%g
|
||||
s%@BUILD_FLAGS@%$BUILD_FLAGS%g
|
||||
s%@SHARE_FLAGS@%$SHARE_FLAGS%g
|
||||
s%@DMALLOC@%$DMALLOC%g
|
||||
|
||||
CEOF
|
||||
EOF
|
||||
|
@ -14,10 +14,7 @@ dnl Checks for header files.
|
||||
AC_CHECK_HEADERS(fcntl.h malloc.h stdlib.h sys/stat.h sys/time.h sys/types.h \
|
||||
sys/utime.h unistd.h utime.h)
|
||||
|
||||
dnl Check for zlib. Make sure it comes with zlib.h.
|
||||
LIBS=""
|
||||
AC_CHECK_LIB(z, deflate,
|
||||
AC_CHECK_HEADER(zlib.h, AC_DEFINE(HAVE_LIBZ) LIBS="$LIBS -lz"))
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
@ -130,10 +127,57 @@ if test $nufxlib_cv_sprintf_returns_int = "yes"; then
|
||||
fi
|
||||
AC_MSG_RESULT($nufxlib_cv_sprintf_returns_int)
|
||||
|
||||
DMALLOC=
|
||||
AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc: do dmalloc stuff], \
|
||||
[ echo "--- enabling dmalloc"; \
|
||||
dnl
|
||||
dnl Allow selective disabling of compression algorithms. By default,
|
||||
dnl all are enabled. We do a little extra work for libz and libbz2
|
||||
dnl because they're not built in.
|
||||
dnl
|
||||
dnl If we're creating a shared library, we need to explicitly link
|
||||
dnl against libz and/or libbz2 when those features are enabled.
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(sq,
|
||||
[ --disable-sq disable SQ compression],
|
||||
[ ], [ enable_sq=yes ])
|
||||
if test $enable_sq = "yes"; then
|
||||
AC_DEFINE(ENABLE_SQ)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(lzw,
|
||||
[ --disable-lzw disable LZW/1 and LZW/2 compression],
|
||||
[ ], [ enable_lzw=yes ])
|
||||
if test $enable_lzw = "yes"; then
|
||||
AC_DEFINE(ENABLE_LZW)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(lzc,
|
||||
[ --disable-lzc disable 12- and 16-bit LZC compression],
|
||||
[ ], [ enable_lzc=yes ])
|
||||
if test $enable_lzc = "yes"; then
|
||||
AC_DEFINE(ENABLE_LZC)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(deflate,
|
||||
[ --disable-deflate disable zlib deflate compression],
|
||||
[ ], [ enable_deflate=yes ])
|
||||
if test $enable_deflate = "yes"; then
|
||||
dnl Check for zlib. Make sure it comes with zlib.h.
|
||||
AC_CHECK_LIB(z, deflate,
|
||||
AC_CHECK_HEADER(zlib.h, AC_DEFINE(ENABLE_DEFLATE) LIBS="$LIBS -lz"))
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(bzip2,
|
||||
[ --enable-bzip2 enable libbz2 bzip2 compression],
|
||||
[ ], [ enable_bzip2=no ])
|
||||
if test $enable_bzip2 = "yes"; then
|
||||
dnl Check for libbz2. Make sure it comes with bzlib.h.
|
||||
AC_CHECK_LIB(bz2, BZ2_bzCompress,
|
||||
AC_CHECK_HEADER(bzlib.h, AC_DEFINE(ENABLE_BZIP2) LIBS="$LIBS -lbz2"))
|
||||
fi
|
||||
|
||||
|
||||
AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc do dmalloc stuff],
|
||||
[ echo "--- enabling dmalloc";
|
||||
LIBS="$LIBS -L/usr/local/lib -ldmalloc"; AC_DEFINE(USE_DMALLOC) ])
|
||||
AC_SUBST(DMALLOC)
|
||||
|
||||
AC_OUTPUT(Makefile samples/Makefile)
|
||||
|
Loading…
x
Reference in New Issue
Block a user