Added support for bzip2 compression.

Use NuTestFeature to determine which compression methods are available.
This commit is contained in:
Andy McFadden 2002-10-09 23:12:33 +00:00
parent d41016e6c1
commit edc69e56ca
11 changed files with 304 additions and 127 deletions

View File

@ -911,11 +911,16 @@ OpenArchiveReadWrite(NulibState* pState)
err = NuSetValue(pArchive, kNuValueDataCompression, kNuCompressNone);
BailError(err);
}
/* handle "-9" flag */
/* handle "-z" flag */
if (NState_GetModCompressDeflate(pState)) {
err = NuSetValue(pArchive, kNuValueDataCompression, kNuCompressDeflate);
BailError(err);
}
/* handle "-zz" flag */
if (NState_GetModCompressBzip2(pState)) {
err = NuSetValue(pArchive, kNuValueDataCompression, kNuCompressBzip2);
BailError(err);
}
/* handle "-f" and "-u" flags */
/* (BUG: if "-f" is set, creating a new archive is impossible) */

View File

@ -18,7 +18,7 @@ enum RecordKind {
};
static const char* gShortFormatNames[] = {
"unc", "squ", "lz1", "lz2", "u12", "u16", "dfl"
"unc", "squ", "lz1", "lz2", "u12", "u16", "dfl", "bzp"
};

View File

@ -162,17 +162,16 @@ Usage(const NulibState* pState)
" modifiers:\n"
" -u update files (add + keep newest) -f freshen (update, no add)\n"
" -r recurse into subdirs -j junk (don't record) directory names\n"
" -0 don't use compression -c add one-line comments\n"
#ifdef HAVE_LIBZ
" -z use gzip 'deflate' compression "
#else
" -z use zlib [not included] "
#endif
#ifdef HAVE_LIBBZ2
"-zz use bzip2 'BWT' compression\n"
#else
"-zz use BWT [not included]\n"
#endif
" -0 don't use compression -c add one-line comments\n");
if (NuTestFeature(kNuFeatureCompressDeflate) == kNuErrNone)
printf(" -z use gzip 'deflate' compression ");
else
printf(" -z use zlib [not included] ");
if (NuTestFeature(kNuFeatureCompressBzip2) == kNuErrNone)
printf("-zz use bzip2 'BWT' compression\n");
else
printf("-zz use BWT [not included]\n");
printf(
" -l auto-convert text files -ll convert CR/LF on ALL files\n"
" -s stomp existing files w/o asking -k store files as disk images\n"
" -e preserve ProDOS file types -ee preserve types and extend names\n"
@ -263,9 +262,21 @@ DoHelp(const NulibState* pState)
printf("\n%s", help[i].longDescr);
}
putchar('\n');
printf("Compression algorithms supported by this copy of NufxLib:\n");
printf(" Huffman SQueeze ...... %s\n",
NuTestFeature(kNuFeatureCompressHuffmanSQ) == kNuErrNone? "yes" : "no");
printf(" LZW/1 and LZW/2 ...... %s\n",
NuTestFeature(kNuFeatureCompressLZW) == kNuErrNone ? "yes" : "no");
printf(" 12- and 16-bit LZC ... %s\n",
NuTestFeature(kNuFeatureCompressLZC) == kNuErrNone ? "yes" : "no");
printf(" Deflate .............. %s\n",
NuTestFeature(kNuFeatureCompressDeflate) == kNuErrNone ? "yes" : "no");
printf(" bzip2 ................ %s\n",
NuTestFeature(kNuFeatureCompressBzip2) == kNuErrNone ? "yes" : "no");
return kNuErrNone;
}
@ -354,22 +365,20 @@ ProcessOptions(NulibState* pState, int argc, char* const* argv)
case 'b': NState_SetModBinaryII(pState, true); break;
case 'z':
if (*(cp+1) == 'z') {
#ifdef HAVE_LIBBZ2
NState_SetModCompressBWT(pState, true);
#else
fprintf(stderr,
"%s: WARNING: libbzip2 support not compiled in\n",
gProgName);
#endif
if (NuTestFeature(kNuFeatureCompressBzip2) == kNuErrNone)
NState_SetModCompressBzip2(pState, true);
else
fprintf(stderr,
"%s: WARNING: libbz2 support not compiled in\n",
gProgName);
cp++;
} else {
#ifdef HAVE_LIBZ
NState_SetModCompressDeflate(pState, true);
#else
fprintf(stderr,
"%s: WARNING: zlib support not compiled in\n",
gProgName);
#endif
if (NuTestFeature(kNuFeatureCompressDeflate) == kNuErrNone)
NState_SetModCompressDeflate(pState, true);
else
fprintf(stderr,
"%s: WARNING: zlib support not compiled in\n",
gProgName);
}
break;
case 'e':

View File

@ -77,7 +77,9 @@ install-shared:
LIB_PRODUCT="libnufx.so" $(MAKE) -e install
# Link against the shared version of libnufx. This is only needed so
# the dependency checking does the right thing.
# the dependency checking does the right thing during development. Note
# we probably don't need to link against all of LIBS, especially -lz -lbz2,
# but there's little harm in doing so.
shared::
LIB_PRODUCT="libnufx.so" $(MAKE) -e

View File

@ -1,4 +1,4 @@
NuLib2 README, updated 2000/05/18
NuLib2 README, updated 2002/10/09
http://www.nulib.com/
See "COPYING" for distribution restrictions.
@ -20,10 +20,16 @@ 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.
If you have diabled deflate or enabled bzip2 support in libnufx.a, you
will need to provide the same --enable-METHOD or --disable-METHOD flag
to configure here. If you're using shared libraries then the link
dependencies are taken care of and you don't need to worry.
Run "make depend" if you have makedepend, and then type "make".
This should leave you with an executable called "nulib2". If you like,
"make install" will put things into your install directory, usually
/usr/local/bin/ and /usr/local/man/.
/usr/local/bin/ and /usr/local/man/. You can change this by using
"./configure --prefix=directory".
You may want to fiddle with the "OPT" setting in Makefile to enable or
disable optimizations and assertions. Because almost all of the hard

View File

@ -126,6 +126,8 @@ NState_DebugDump(const NulibState* pState)
printf(" noCompression\n");
if (pState->modCompressDeflate)
printf(" compressDeflate\n");
if (pState->modCompressBzip2)
printf(" compressBzip2\n");
if (pState->modComments)
printf(" comments\n");
if (pState->modBinaryII)
@ -430,6 +432,18 @@ NState_SetModCompressDeflate(NulibState* pState, Boolean val)
pState->modCompressDeflate = val;
}
Boolean
NState_GetModCompressBzip2(const NulibState* pState)
{
return pState->modCompressBzip2;
}
void
NState_SetModCompressBzip2(NulibState* pState, Boolean val)
{
pState->modCompressBzip2 = val;
}
Boolean
NState_GetModComments(const NulibState* pState)
{

View File

@ -65,6 +65,7 @@ typedef struct NulibState {
Boolean modJunkPaths;
Boolean modNoCompression;
Boolean modCompressDeflate;
Boolean modCompressBzip2;
Boolean modComments;
Boolean modBinaryII;
Boolean modConvertText;
@ -132,6 +133,8 @@ Boolean NState_GetModNoCompression(const NulibState* pState);
void NState_SetModNoCompression(NulibState* pState, Boolean val);
Boolean NState_GetModCompressDeflate(const NulibState* pState);
void NState_SetModCompressDeflate(NulibState* pState, Boolean val);
Boolean NState_GetModCompressBzip2(const NulibState* pState);
void NState_SetModCompressBzip2(NulibState* pState, Boolean val);
Boolean NState_GetModComments(const NulibState* pState);
void NState_SetModComments(NulibState* pState, Boolean val);
Boolean NState_GetModBinaryII(const NulibState* pState);

View File

@ -104,9 +104,6 @@
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have libz.a or libz.so */
#undef HAVE_LIBZ
/* Define if we want to use the dmalloc library (--enable-dmalloc). */
#undef USE_DMALLOC

248
nulib2/configure vendored
View File

@ -12,7 +12,11 @@ ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
--enable-dmalloc: do dmalloc stuff"
--disable-deflate don't link against libz"
ac_help="$ac_help
--enable-bzip2 do link against libbz2"
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 +555,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:559: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@ -574,7 +578,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:582: 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 +608,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:612: 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 +659,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:663: 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 +691,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:695: 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 +702,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
#line 702 "configure"
#line 706 "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:711: \"$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 +733,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:737: 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:742: 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 +747,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:751: \"$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 +766,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:770: 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 +809,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:813: 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
@ -863,12 +867,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
echo "configure:867: checking for $ac_hdr that defines DIR" >&5
echo "configure:871: checking for $ac_hdr that defines DIR" >&5
if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 872 "configure"
#line 876 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
@ -876,7 +880,7 @@ int main() {
DIR *dirp = 0;
; return 0; }
EOF
if { (eval echo configure:880: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:884: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
@ -901,7 +905,7 @@ done
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
echo "configure:905: checking for opendir in -ldir" >&5
echo "configure:909: checking for opendir in -ldir" >&5
ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -909,7 +913,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
#line 913 "configure"
#line 917 "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
@ -920,7 +924,7 @@ int main() {
opendir()
; return 0; }
EOF
if { (eval echo configure:924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:928: \"$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
@ -942,7 +946,7 @@ fi
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
echo "configure:946: checking for opendir in -lx" >&5
echo "configure:950: checking for opendir in -lx" >&5
ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -950,7 +954,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
#line 954 "configure"
#line 958 "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
@ -961,7 +965,7 @@ int main() {
opendir()
; return 0; }
EOF
if { (eval echo configure:965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:969: \"$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
@ -984,7 +988,7 @@ fi
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:988: checking how to run the C preprocessor" >&5
echo "configure:992: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -999,13 +1003,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 1003 "configure"
#line 1007 "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:1009: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1013: \"$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
:
@ -1016,13 +1020,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 1020 "configure"
#line 1024 "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:1026: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1030: \"$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
:
@ -1033,13 +1037,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
#line 1037 "configure"
#line 1041 "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:1043: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1047: \"$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
:
@ -1064,12 +1068,12 @@ fi
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
echo "configure:1068: checking for ANSI C header files" >&5
echo "configure:1072: 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 1073 "configure"
#line 1077 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@ -1077,7 +1081,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1081: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1085: \"$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*
@ -1094,7 +1098,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 1098 "configure"
#line 1102 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@ -1112,7 +1116,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 1116 "configure"
#line 1120 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@ -1133,7 +1137,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 1137 "configure"
#line 1141 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@ -1144,7 +1148,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
if { (eval echo configure:1148: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@ -1172,17 +1176,17 @@ for ac_hdr in fcntl.h limits.h malloc.h stdlib.h strings.h sys/stat.h \
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1176: checking for $ac_hdr" >&5
echo "configure:1180: 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 1181 "configure"
#line 1185 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1186: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1190: \"$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*
@ -1210,8 +1214,18 @@ done
LIBS=""
echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6
echo "configure:1215: checking for deflate in -lz" >&5
# 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:1229: 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
@ -1219,7 +1233,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lz $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1223 "configure"
#line 1237 "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
@ -1230,7 +1244,7 @@ int main() {
deflate()
; return 0; }
EOF
if { (eval echo configure:1234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1248: \"$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
@ -1247,17 +1261,17 @@ 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:1251: checking for zlib.h" >&5
echo "configure:1265: 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 1256 "configure"
#line 1270 "configure"
#include "confdefs.h"
#include <zlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1261: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1275: \"$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*
@ -1273,10 +1287,90 @@ 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
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:1312: 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 1320 "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
LIBS="$LIBS -lz"
if { (eval echo configure:1331: \"$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:1348: 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 1353 "configure"
#include "confdefs.h"
#include <bzlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1358: \"$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
LIBS="$LIBS -lbz2"
else
echo "$ac_t""no" 1>&6
fi
@ -1285,14 +1379,15 @@ else
echo "$ac_t""no" 1>&6
fi
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
echo "configure:1291: checking for working const" >&5
echo "configure:1386: 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 1296 "configure"
#line 1391 "configure"
#include "confdefs.h"
int main() {
@ -1341,7 +1436,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
if { (eval echo configure:1345: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1440: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@ -1362,12 +1457,12 @@ EOF
fi
echo $ac_n "checking for mode_t""... $ac_c" 1>&6
echo "configure:1366: checking for mode_t" >&5
echo "configure:1461: 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 1371 "configure"
#line 1466 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1395,12 +1490,12 @@ EOF
fi
echo $ac_n "checking for off_t""... $ac_c" 1>&6
echo "configure:1399: checking for off_t" >&5
echo "configure:1494: 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 1404 "configure"
#line 1499 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1428,12 +1523,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
echo "configure:1432: checking for size_t" >&5
echo "configure:1527: 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 1437 "configure"
#line 1532 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1461,12 +1556,12 @@ EOF
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
echo "configure:1465: checking whether struct tm is in sys/time.h or time.h" >&5
echo "configure:1560: 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 1470 "configure"
#line 1565 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
@ -1474,7 +1569,7 @@ int main() {
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
if { (eval echo configure:1478: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1573: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
@ -1495,12 +1590,12 @@ EOF
fi
echo $ac_n "checking for uchar""... $ac_c" 1>&6
echo "configure:1499: checking for uchar" >&5
echo "configure:1594: 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 1504 "configure"
#line 1599 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1528,12 +1623,12 @@ EOF
fi
echo $ac_n "checking for ushort""... $ac_c" 1>&6
echo "configure:1532: checking for ushort" >&5
echo "configure:1627: 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 1537 "configure"
#line 1632 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1561,12 +1656,12 @@ EOF
fi
echo $ac_n "checking for uint""... $ac_c" 1>&6
echo "configure:1565: checking for uint" >&5
echo "configure:1660: 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 1570 "configure"
#line 1665 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1594,12 +1689,12 @@ EOF
fi
echo $ac_n "checking for ulong""... $ac_c" 1>&6
echo "configure:1598: checking for ulong" >&5
echo "configure:1693: 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 1603 "configure"
#line 1698 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1628,7 +1723,7 @@ fi
echo $ac_n "checking whether utime accepts a null argument""... $ac_c" 1>&6
echo "configure:1632: checking whether utime accepts a null argument" >&5
echo "configure:1727: checking whether utime accepts a null argument" >&5
if eval "test \"`echo '$''{'ac_cv_func_utime_null'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1638,7 +1733,7 @@ if test "$cross_compiling" = yes; then
ac_cv_func_utime_null=no
else
cat > conftest.$ac_ext <<EOF
#line 1642 "configure"
#line 1737 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@ -1649,7 +1744,7 @@ exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0
&& t.st_mtime - s.st_mtime < 120));
}
EOF
if { (eval echo configure:1653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_utime_null=yes
else
@ -1675,12 +1770,12 @@ fi
for ac_func in memmove mkdir strtoul strcasecmp strncasecmp strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1679: checking for $ac_func" >&5
echo "configure:1774: 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 1684 "configure"
#line 1779 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1703,7 +1798,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1802: \"$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
@ -1765,7 +1860,6 @@ fi
DMALLOC=
# Check whether --enable-dmalloc or --disable-dmalloc was given.
if test "${enable_dmalloc+set}" = set; then
enableval="$enable_dmalloc"
@ -1778,7 +1872,6 @@ EOF
fi
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
@ -1923,7 +2016,6 @@ s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@CPP@%$CPP%g
s%@BUILD_FLAGS@%$BUILD_FLAGS%g
s%@DMALLOC@%$DMALLOC%g
CEOF
EOF

View File

@ -13,10 +13,37 @@ AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h limits.h malloc.h stdlib.h strings.h sys/stat.h \
sys/time.h sys/types.h unistd.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
dnl Check for libz and libbz2. We want to link against them in case
dnl NufxLib has them enabled. If they're not enabled, we don't want to
dnl link against them if they're shared libraries, because it'll create
dnl an unnecessary shared lib dependency. Won't matter unless you try
dnl to copy the binary to another machine.
dnl
dnl So, we try to link against the libraries unless they're explicitly
dnl disabled by the person building them. Not ideal, but it'll work.
dnl Of course, if nufxlib is built as a shared library, the dependencies
dnl will be handled correctly without having to use -l here.
dnl
AC_ARG_ENABLE(deflate,
[ --disable-deflate don't link against libz],
[ ], [ 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, LIBS="$LIBS -lz"))
fi
AC_ARG_ENABLE(bzip2,
[ --enable-bzip2 do link against libbz2],
[ ], [ 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, LIBS="$LIBS -lbz2"))
fi
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
@ -78,10 +105,8 @@ fi
AC_SUBST(BUILD_FLAGS)
DMALLOC=
AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc: do dmalloc stuff], \
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)

View File

@ -1,12 +1,12 @@
.\" nulib2.1
.\" Copyright (C) 2000 by Andy McFadden. All Rights Reserved.
.\" Copyright (C) 2002 by Andy McFadden. All Rights Reserved.
.\" This is free software; you can redistribute it and/or modify it under the
.\" terms of the GNU General Public License, see the file COPYING.
.\"
.\" The general structure of this man page was borrowed from "zip.1" in
.\" the Red Hat Linux 6.0 distribution.
.\"
.TH NULIB2 1L "17 Jan 2000"
.TH NULIB2 1L "09 Oct 2002"
.SH NAME
nulib2 \- package and compress (archive) files
.SH SYNOPSIS
@ -23,10 +23,15 @@ to and extract files from
.IR .SEA
(as created by GS/ShrinkIt), and
.I .BSE
files.
files. In addition, it can extract files from
.IR .BNY
and
.IR .BQY
Binary II archives.
.LP
When extracting, testing, or listing the contents of an archive, you can
specify "-" for the archive name. The archive will be read from stdin.
(If the archive is Binary II, you must specify the "-b" flag.)
.LP
Filenames are considered case-sensitive.
.\" .LP
@ -40,6 +45,9 @@ This man page contains a summary of available options. For full
documentation and the latest versions, visit http://www.nulib.com/.
.SH "OPTIONS"
.TP
.B \-h
Get verbose help output.
.TP
.B \-a
Add files to an archive. If the archive does not exist, a new one
will be created. The list of files to add must be given.
@ -66,13 +74,10 @@ shown.
.B \-x
Extract files from an archive. If no files are listed, all files in
the archive are extracted.
.\" There's also a '-z' command that does a verbose archive dump, but it's
.\" There's also a '-g' command that does a verbose archive dump, but it's
.\" only available if NufxLib was built with debugging enabled.
.SH "MODIFIERS"
.TP
.B \-0
Don't use compression. Files added will be stored without compression.
.TP
.B \-c
Comments. When extracting, comments will be displayed. When adding,
you will be prompted to enter a one-line comment for every file.
@ -127,6 +132,25 @@ or delete entire subdirectories from the archive.
Update files. When adding, files in the archive that are older than files
on disk are updated. Files in the archive that are the same age or newer
aren't touched. New files will be added. Works similarly when extracting.
.TP
.B \-b
Binary II. Forces NuLib2 to treat the archive as Binary II. Useful for
opening NuFX-in-BNY archives (.BXY) if you want to strip the wrapper off.
You must specify this for Binary II archives on stdin.
.TP
.B \-0
Don't use compression. Files added will be stored without compression.
(Note that's dash-zero, not dash-oh.)
.TP
.B \-z
Use "deflate" compression. This option is only available if libz was
linked against. Archives created with this algorithm will not be
usable on an Apple II.
.TP
.B \-zz
Use "bzip2" compression. This option is only available if libbz2 was
linked against. Archives created with this algorithm will not be
usable on an Apple II.
.SH "EXAMPLES"
A simple example:
.IP
@ -172,7 +196,7 @@ zip(1L),
unzip(1L),
nulib(1L)
.SH BUGS
Probably.
Nah.
.SH AUTHOR
Copyright (C) 2000 by Andy McFadden. All Rights Reserved.
Copyright (C) 2002 by Andy McFadden. All Rights Reserved.
.\" end of file