mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2025-01-19 23:20:59 +00:00
configure.in:
make zlib enabled by default common/nozip.h: swap the size and count params to f{read,write} to prevent demo code breaking common/quakefs.c: if zlib is unavailable, there is no point in supporting the .gz extension
This commit is contained in:
parent
218d2fcb9b
commit
0a46c1d979
3 changed files with 12 additions and 5 deletions
|
@ -27,8 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#ifndef HAS_ZLIB
|
#ifndef HAS_ZLIB
|
||||||
#define gzFile FILE
|
#define gzFile FILE
|
||||||
#define gzdopen fdopen
|
#define gzdopen fdopen
|
||||||
#define gzread(F, BUF, LEN) fread(BUF, LEN, 1, F)
|
#define gzread(F, BUF, LEN) fread(BUF, 1, LEN, F)
|
||||||
#define gzwrite(F, BUF, LEN) fwrite(BUF, LEN, 1, F)
|
#define gzwrite(F, BUF, LEN) fwrite(BUF, 1, LEN, F)
|
||||||
/* #define gzwrite(F, BUF, SIZE,LEN) fwrite( */
|
/* #define gzwrite(F, BUF, SIZE,LEN) fwrite( */
|
||||||
#define gzflush(FILE, VAL) fflush(FILE)
|
#define gzflush(FILE, VAL) fflush(FILE)
|
||||||
#define gzprintf fprintf
|
#define gzprintf fprintf
|
||||||
|
|
|
@ -310,10 +310,12 @@ int COM_FOpenFile (char *filename, gzFile **gzfile)
|
||||||
pack_t *pak;
|
pack_t *pak;
|
||||||
int i;
|
int i;
|
||||||
int findtime;
|
int findtime;
|
||||||
|
#ifdef HAS_ZLIB
|
||||||
char gzfilename[MAX_OSPATH];
|
char gzfilename[MAX_OSPATH];
|
||||||
|
|
||||||
strncpy(gzfilename,filename,sizeof(gzfilename));
|
strncpy(gzfilename,filename,sizeof(gzfilename));
|
||||||
strncat(gzfilename,".gz",sizeof(gzfilename));
|
strncat(gzfilename,".gz",sizeof(gzfilename));
|
||||||
|
#endif
|
||||||
|
|
||||||
file_from_pak = 0;
|
file_from_pak = 0;
|
||||||
|
|
||||||
|
@ -331,8 +333,10 @@ int COM_FOpenFile (char *filename, gzFile **gzfile)
|
||||||
char *fn=0;
|
char *fn=0;
|
||||||
if (!strcmp (pak->files[i].name, filename))
|
if (!strcmp (pak->files[i].name, filename))
|
||||||
fn=filename;
|
fn=filename;
|
||||||
|
#ifdef HAS_ZLIB
|
||||||
else if (!strcmp (pak->files[i].name, gzfilename))
|
else if (!strcmp (pak->files[i].name, gzfilename))
|
||||||
fn=gzfilename;
|
fn=gzfilename;
|
||||||
|
#endif
|
||||||
if (fn)
|
if (fn)
|
||||||
{ // found it!
|
{ // found it!
|
||||||
if(developer.value)
|
if(developer.value)
|
||||||
|
@ -358,10 +362,12 @@ int COM_FOpenFile (char *filename, gzFile **gzfile)
|
||||||
|
|
||||||
findtime = Sys_FileTime (netpath);
|
findtime = Sys_FileTime (netpath);
|
||||||
if (findtime == -1) {
|
if (findtime == -1) {
|
||||||
|
#ifdef HAS_ZLIB
|
||||||
snprintf(netpath, sizeof(netpath), "%s/%s",search->filename,
|
snprintf(netpath, sizeof(netpath), "%s/%s",search->filename,
|
||||||
gzfilename);
|
gzfilename);
|
||||||
findtime = Sys_FileTime (netpath);
|
findtime = Sys_FileTime (netpath);
|
||||||
if (findtime == -1)
|
if (findtime == -1)
|
||||||
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ AC_ARG_ENABLE(alsa,
|
||||||
)
|
)
|
||||||
|
|
||||||
AC_ARG_ENABLE(zlib,
|
AC_ARG_ENABLE(zlib,
|
||||||
[ --enable-zlib enable zlib support],
|
[ --disable-zlib disable zlib support],
|
||||||
)
|
)
|
||||||
|
|
||||||
dnl Checks for stricmp/strcasecmp
|
dnl Checks for stricmp/strcasecmp
|
||||||
|
@ -123,7 +123,8 @@ fi
|
||||||
dnl Checks for working -lm
|
dnl Checks for working -lm
|
||||||
AC_CHECK_LIB(m, pow,, AC_MSG_ERROR([math library (-lm) appears broken]))
|
AC_CHECK_LIB(m, pow,, AC_MSG_ERROR([math library (-lm) appears broken]))
|
||||||
|
|
||||||
if test "x$enable_zlib" = "xyes"; then
|
echo $enable_zlib
|
||||||
|
if test "x$enable_zlib" != "xno"; then
|
||||||
dnl Check for working -lz
|
dnl Check for working -lz
|
||||||
dnl Note - must have gztell *and* gzgets in -lz *and* zlib.h
|
dnl Note - must have gztell *and* gzgets in -lz *and* zlib.h
|
||||||
AC_CHECK_LIB(z, gztell, HAS_ZLIB=yes, HAS_ZLIB=no, [$LIBS])
|
AC_CHECK_LIB(z, gztell, HAS_ZLIB=yes, HAS_ZLIB=no, [$LIBS])
|
||||||
|
|
Loading…
Reference in a new issue