Various changes to get build to work when zlib isn't available...

Various changes to get rid of warnings under AIX, Irix, Linux & Solaris...
This commit is contained in:
Loring Holden 2000-02-03 08:46:52 +00:00
parent 713e84ecae
commit 8349f3e59f
17 changed files with 143 additions and 21 deletions

View file

@ -41,5 +41,14 @@
/* Define this to use experimental code */ /* Define this to use experimental code */
#undef _EXPERIMENTAL_ #undef _EXPERIMENTAL_
@BOTTOM@ /* Define this to use zlib */
#undef HAS_ZLIB
/* Define this if your system has socklen_t */
#undef HAS_SOCKLEN_T
#ifndef HAS_SOCKLEN_T
typedef int socklen_t;
# define HAS_SOCKLEN_T
#endif
@BOTTOM@

View file

@ -53,7 +53,9 @@ static void CDAudio_Eject()
void CDAudio_Play(byte track, qboolean looping) void CDAudio_Play(byte track, qboolean looping)
{ {
CDstatus cd_stat; /* Initialize cd_stat to avoid warning */
/* XXX - Does this default value make sense? */
CDstatus cd_stat = CD_ERROR;
if(!cd_id || !enabled) return; if(!cd_id || !enabled) return;
if(!cdValid) if(!cdValid)

View file

@ -23,9 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
#include <lib_replace.h> #include <lib_replace.h>
static void CD_f(void);
#if defined(USE_LINUX_CD) || defined(USE_BSD_CD) #if defined(USE_LINUX_CD) || defined(USE_BSD_CD)
static void CD_f(void);
# include "cd_linux.c" # include "cd_linux.c"
#elif defined(_WIN32) #elif defined(_WIN32)
# include "cd_win.c" # include "cd_win.c"

View file

@ -35,6 +35,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdlib.h> #include <stdlib.h>
#include <setjmp.h> #include <setjmp.h>
#include <time.h> #include <time.h>
#ifdef HAVE_STRING_H
#include <strings.h>
#endif
#if defined(_WIN32) && !defined(WINDED) #if defined(_WIN32) && !defined(WINDED)
void VID_LockBuffer (void); void VID_LockBuffer (void);

View file

@ -329,24 +329,24 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr)
// save out the cached version // save out the cached version
// //
snprintf(fullpath, sizeof(fullpath), "%s/%s", com_gamedir, cache); snprintf(fullpath, sizeof(fullpath), "%s/%s", com_gamedir, cache);
f = fopen (fullpath, "wb"); f = gzopen (fullpath, "wb");
#ifdef QUAKEWORLD #ifdef QUAKEWORLD
if (!f) { if (!f) {
char gldir[MAX_OSPATH]; char gldir[MAX_OSPATH];
snprintf(gldir, sizeof(gldir), "%s/glquake", com_gamedir); snprintf(gldir, sizeof(gldir), "%s/glquake", com_gamedir);
Sys_mkdir (gldir); Sys_mkdir (gldir);
f = fopen (fullpath, "wb"); f = gzopen (fullpath, "wb");
} }
#endif #endif
if (f) if (f)
{ {
fwrite (&numcommands, 4, 1, f); gzwrite(f, &numcommands, 4);
fwrite (&numorder, 4, 1, f); gzwrite(f, &numorder, 4);
fwrite (commands, numcommands * sizeof(commands[0]), 1, f); gzwrite(f, commands, numcommands * sizeof(commands[0]));
fwrite (vertexorder, numorder * sizeof(vertexorder[0]), 1, f); gzwrite(f, vertexorder, numorder * sizeof(vertexorder[0]));
fclose (f); gzclose (f);
} }
} }

View file

@ -439,9 +439,9 @@ void VID_SetPalette (unsigned char *palette)
snprintf(s, sizeof(s), "%s/glquake", com_gamedir); snprintf(s, sizeof(s), "%s/glquake", com_gamedir);
Sys_mkdir (s); Sys_mkdir (s);
snprintf(s, sizeof(s), "%s/glquake/15to8.pal", com_gamedir); snprintf(s, sizeof(s), "%s/glquake/15to8.pal", com_gamedir);
if ((f = fopen(s, "wb")) != NULL) { if ((f = gzopen(s, "wb")) != NULL) {
fwrite(d_15to8table, 1<<15, 1, f); gzwrite(f, d_15to8table, 1<<15);
fclose(f); gzclose(f);
} }
} }
} }

42
common/nozip.h Normal file
View file

@ -0,0 +1,42 @@
/*
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// comndef.h -- general definitions
#ifndef _NOZIP_H
#define _NOZIP_H
#include "config.h"
#ifndef HAS_ZLIB
#define gzFile FILE
#define gzdopen fdopen
#define gzread(F, BUF, LEN) fread(BUF, LEN, 1, F)
#define gzwrite(F, BUF, LEN) fwrite(BUF, LEN, 1, F)
/* #define gzwrite(F, BUF, SIZE,LEN) fwrite( */
#define gzflush(FILE, VAL) fflush(FILE)
#define gzprintf fprintf
#define gzgetc fgetc
#define gzseek fseek
#define gztell ftell
#define gzopen fopen
#define gzclose fclose
#define gzgets(FILE,BUF,SIZE) fgets(BUF,SIZE,FILE)
#endif
#endif // _NOZIP_H

View file

@ -63,10 +63,12 @@ QUAKE FILESYSTEM
typedef unsigned char byte_t; typedef unsigned char byte_t;
char gamedirfile[MAX_OSPATH]; char gamedirfile[MAX_OSPATH];
#if 0
#ifndef _AIX #ifndef _AIX
typedef unsigned int uint_t; typedef unsigned int uint_t;
typedef unsigned short ushort_t; typedef unsigned short ushort_t;
#endif #endif
#endif
/* End Generations */ /* End Generations */
int com_filesize; int com_filesize;

View file

@ -23,8 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _QUAKEFS_H #ifndef _QUAKEFS_H
#define _QUAKEFS_H #define _QUAKEFS_H
#include "config.h"
#ifdef HAS_ZLIB
#include <zlib.h> #include <zlib.h>
#else
#include "nozip.h"
#endif
//============================================================================ //============================================================================

View file

@ -31,6 +31,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#else #else
#define DWORD unsigned long #define DWORD unsigned long
#endif #endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_MEMORY_H
#include <memory.h>
#endif
#define PAINTBUFFER_SIZE 512 #define PAINTBUFFER_SIZE 512
portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE]; portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE];

View file

@ -25,6 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "keys.h" #include "keys.h"
#include "quakedef.h" #include "quakedef.h"
#include "d_local.h" #include "d_local.h"
#include "sound.h"
#include "cvar.h"
#include "draw.h"
cvar_t _windowed_mouse = {"_windowed_mouse","0", true}; cvar_t _windowed_mouse = {"_windowed_mouse","0", true};
static float old_windowed_mouse = 0; static float old_windowed_mouse = 0;

View file

@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// vid_x.c -- general x video driver // vid_x.c -- general x video driver
#define _BSD #define _BSD
#include "config.h"
#include <ctype.h> #include <ctype.h>
#include <sys/time.h> #include <sys/time.h>
@ -46,6 +47,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
#include "d_local.h" #include "d_local.h"
#include "keys.h" #include "keys.h"
#include "console.h"
#include "sound.h"
#include "cvar.h"
#include "draw.h"
#include "cmd.h"
#include "lib_replace.h"
#include "common.h"
#include "sys.h"
cvar_t _windowed_mouse = {"_windowed_mouse","0", true}; cvar_t _windowed_mouse = {"_windowed_mouse","0", true};
cvar_t m_filter = {"m_filter","0", true}; cvar_t m_filter = {"m_filter","0", true};

View file

@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// vid_x.c -- general x video driver // vid_x.c -- general x video driver
#define _BSD #define _BSD
#include "config.h"
#include <ctype.h> #include <ctype.h>
#include <sys/time.h> #include <sys/time.h>
@ -55,6 +56,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <draw.h> #include <draw.h>
#include <console.h> #include <console.h>
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
cvar_t _windowed_mouse = {"_windowed_mouse","0", true}; cvar_t _windowed_mouse = {"_windowed_mouse","0", true};
cvar_t m_filter = {"m_filter","0", true}; cvar_t m_filter = {"m_filter","0", true};

View file

@ -30,7 +30,7 @@ AC_CHECK_HEADERS(unistd.h fcntl.h dlfcn.h windows.h sys/ioctl.h sys/mman.h \
sys/socket.h netinet/in.h netdb.h arpa/inet.h sys/filio.h \ sys/socket.h netinet/in.h netdb.h arpa/inet.h sys/filio.h \
sys/soundcard.h linux/soundcard.h machine/soundcard.h sys/audioio.h \ sys/soundcard.h linux/soundcard.h machine/soundcard.h sys/audioio.h \
dsound.h mmsystem.h initguid.h mme/mmsystem.h mme/mme_public.h \ dsound.h mmsystem.h initguid.h mme/mmsystem.h mme/mme_public.h \
sys/asoundlib.h) sys/asoundlib.h string.h strings.h memory.h)
dnl Checks for typedefs, structures, and compiler characteristics. dnl Checks for typedefs, structures, and compiler characteristics.
AC_PROG_GCC_TRADITIONAL AC_PROG_GCC_TRADITIONAL
@ -39,6 +39,11 @@ AC_C_INLINE
AC_HEADER_TIME AC_HEADER_TIME
AC_STRUCT_TM AC_STRUCT_TM
AC_C_BIGENDIAN AC_C_BIGENDIAN
AC_MSG_CHECKING(for socklen_t in sys/socket.h)
AC_TRY_COMPILE([#include "sys/socket.h"],
[ socklen_t x = 0;],
AC_DEFINE(HAS_SOCKLEN_T) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
dnl Check for symbol underscore prefix dnl Check for symbol underscore prefix
dnl !!! FIXME !!! Do some real check here... dnl !!! FIXME !!! Do some real check here...
@ -91,6 +96,10 @@ AC_ARG_ENABLE(alsa,
[ --enable-alsa enable alsa support], [ --enable-alsa enable alsa support],
) )
AC_ARG_ENABLE(zlib,
[ --enable-zlib enable zlib support],
)
dnl Checks for stricmp/strcasecmp dnl Checks for stricmp/strcasecmp
AC_CHECK_FUNC(stricmp,, AC_CHECK_FUNC(stricmp,,
AC_CHECK_FUNC(strcasecmp, AC_DEFINE(stricmp,strcasecmp))) AC_CHECK_FUNC(strcasecmp, AC_DEFINE(stricmp,strcasecmp)))
@ -114,9 +123,21 @@ 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$disable_zlib" = "xyes"; then
dnl Check for working -lz dnl Check for working -lz
AC_CHECK_LIB(z, gzopen, LIBS="$LIBS -lz" dnl Note - must have gztell *and* gzgets in -lz *and* zlib.h
HAS_ZLIB=yes, HAS_ZLIB=no, [$LIBS]) AC_CHECK_LIB(z, gztell, HAS_ZLIB=yes, HAS_ZLIB=no, [$LIBS])
if test "x$HAS_ZLIB" = "xyes"; then
AC_CHECK_LIB(z, gzgets, HAS_ZLIB=yes, HAS_ZLIB=no, [$LIBS])
if test "x$HAS_ZLIB" = "xyes"; then
AC_CHECK_HEADER(zlib.h, HAS_ZLIB=yes, HAS_ZLIB=no)
if test "x$HAS_ZLIB" = "xyes"; then
LIBS="-lz $LIBS"
AC_DEFINE(HAS_ZLIB)
fi
fi
fi
fi
dnl Checks for X11 support dnl Checks for X11 support
dnl (XoXus: Since vid_x.c relies on XShm being there, this now disables dnl (XoXus: Since vid_x.c relies on XShm being there, this now disables
@ -492,10 +513,6 @@ case "${target}" in
i?86-*-*) i?86-*-*)
INTEL_ARCH=yes INTEL_ARCH=yes
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
;;
*) AC_MSG_RESULT(no)
esac
AC_MSG_CHECKING(to see if we should disable x86 optimizations) AC_MSG_CHECKING(to see if we should disable x86 optimizations)
AC_ARG_ENABLE(asmopt, AC_ARG_ENABLE(asmopt,
[ --disable-asmopt Disable assembler optimization (on ia32 machines)], [ --disable-asmopt Disable assembler optimization (on ia32 machines)],
@ -506,6 +523,11 @@ if test "x$NO_ASMOPT" = xyes; then
else else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi fi
;;
*) AC_MSG_RESULT(no)
NO_ASMOPT=yes
esac
dnl Check for sound libraries dnl Check for sound libraries
AC_CHECK_LIB(mme,waveOutOpen,HAVE_LIBMME=yes) AC_CHECK_LIB(mme,waveOutOpen,HAVE_LIBMME=yes)

View file

@ -24,7 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _SERVER_H #ifndef _SERVER_H
#define _SERVER_H #define _SERVER_H
#include "config.h"
#ifdef HAS_ZLIB
#include <zlib.h> #include <zlib.h>
#else
#include "nozip.h"
#endif
#include <progs.h> #include <progs.h>

View file

@ -23,6 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "qwsvdef.h" #include "qwsvdef.h"
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
quakeparms_t host_parms; quakeparms_t host_parms;
qboolean host_initialized; // true if into command execution (compatability) qboolean host_initialized; // true if into command execution (compatability)

View file

@ -36,6 +36,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <sys/dir.h> #include <sys/dir.h>
#endif #endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
extern cvar_t sys_nostdout; extern cvar_t sys_nostdout;
cvar_t sys_extrasleep = {"sys_extrasleep","0"}; cvar_t sys_extrasleep = {"sys_extrasleep","0"};