diff --git a/acconfig.h b/acconfig.h index defd5d4..57257e6 100644 --- a/acconfig.h +++ b/acconfig.h @@ -41,5 +41,14 @@ /* Define this to use experimental code */ #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@ diff --git a/common/cd_sdl.c b/common/cd_sdl.c index 7d3016b..14acfcf 100644 --- a/common/cd_sdl.c +++ b/common/cd_sdl.c @@ -53,7 +53,9 @@ static void CDAudio_Eject() 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(!cdValid) diff --git a/common/cd_wrapper.c b/common/cd_wrapper.c index 7bf00d7..5aecb3d 100644 --- a/common/cd_wrapper.c +++ b/common/cd_wrapper.c @@ -23,9 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include -static void CD_f(void); - #if defined(USE_LINUX_CD) || defined(USE_BSD_CD) +static void CD_f(void); # include "cd_linux.c" #elif defined(_WIN32) # include "cd_win.c" diff --git a/common/common_quakedef.h b/common/common_quakedef.h index 600eee3..a8c8b10 100644 --- a/common/common_quakedef.h +++ b/common/common_quakedef.h @@ -35,6 +35,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#ifdef HAVE_STRING_H +#include +#endif #if defined(_WIN32) && !defined(WINDED) void VID_LockBuffer (void); diff --git a/common/gl_mesh.c b/common/gl_mesh.c index b396474..4ed8061 100644 --- a/common/gl_mesh.c +++ b/common/gl_mesh.c @@ -329,24 +329,24 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr) // save out the cached version // snprintf(fullpath, sizeof(fullpath), "%s/%s", com_gamedir, cache); - f = fopen (fullpath, "wb"); + f = gzopen (fullpath, "wb"); #ifdef QUAKEWORLD if (!f) { char gldir[MAX_OSPATH]; snprintf(gldir, sizeof(gldir), "%s/glquake", com_gamedir); Sys_mkdir (gldir); - f = fopen (fullpath, "wb"); + f = gzopen (fullpath, "wb"); } #endif if (f) { - fwrite (&numcommands, 4, 1, f); - fwrite (&numorder, 4, 1, f); - fwrite (commands, numcommands * sizeof(commands[0]), 1, f); - fwrite (vertexorder, numorder * sizeof(vertexorder[0]), 1, f); - fclose (f); + gzwrite(f, &numcommands, 4); + gzwrite(f, &numorder, 4); + gzwrite(f, commands, numcommands * sizeof(commands[0])); + gzwrite(f, vertexorder, numorder * sizeof(vertexorder[0])); + gzclose (f); } } diff --git a/common/gl_vidglx.c b/common/gl_vidglx.c index 082749b..18284b7 100644 --- a/common/gl_vidglx.c +++ b/common/gl_vidglx.c @@ -439,9 +439,9 @@ void VID_SetPalette (unsigned char *palette) snprintf(s, sizeof(s), "%s/glquake", com_gamedir); Sys_mkdir (s); snprintf(s, sizeof(s), "%s/glquake/15to8.pal", com_gamedir); - if ((f = fopen(s, "wb")) != NULL) { - fwrite(d_15to8table, 1<<15, 1, f); - fclose(f); + if ((f = gzopen(s, "wb")) != NULL) { + gzwrite(f, d_15to8table, 1<<15); + gzclose(f); } } } diff --git a/common/nozip.h b/common/nozip.h new file mode 100644 index 0000000..59078fa --- /dev/null +++ b/common/nozip.h @@ -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 diff --git a/common/quakefs.c b/common/quakefs.c index 2e55377..6ca2732 100644 --- a/common/quakefs.c +++ b/common/quakefs.c @@ -63,10 +63,12 @@ QUAKE FILESYSTEM typedef unsigned char byte_t; char gamedirfile[MAX_OSPATH]; +#if 0 #ifndef _AIX typedef unsigned int uint_t; typedef unsigned short ushort_t; #endif +#endif /* End Generations */ int com_filesize; diff --git a/common/quakefs.h b/common/quakefs.h index 257f03f..25714c2 100644 --- a/common/quakefs.h +++ b/common/quakefs.h @@ -23,8 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _QUAKEFS_H #define _QUAKEFS_H +#include "config.h" +#ifdef HAS_ZLIB #include +#else +#include "nozip.h" +#endif //============================================================================ diff --git a/common/snd_mix.c b/common/snd_mix.c index 3604c78..94edc13 100644 --- a/common/snd_mix.c +++ b/common/snd_mix.c @@ -31,6 +31,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #else #define DWORD unsigned long #endif +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef HAVE_MEMORY_H +#include +#endif #define PAINTBUFFER_SIZE 512 portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE]; diff --git a/common/vid_sdl.c b/common/vid_sdl.c index f3f2394..2d2deb4 100644 --- a/common/vid_sdl.c +++ b/common/vid_sdl.c @@ -25,6 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "keys.h" #include "quakedef.h" #include "d_local.h" +#include "sound.h" +#include "cvar.h" +#include "draw.h" cvar_t _windowed_mouse = {"_windowed_mouse","0", true}; static float old_windowed_mouse = 0; diff --git a/common/vid_sunx.c b/common/vid_sunx.c index cd497eb..d404938 100644 --- a/common/vid_sunx.c +++ b/common/vid_sunx.c @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // vid_x.c -- general x video driver #define _BSD +#include "config.h" #include #include @@ -46,6 +47,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "d_local.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 m_filter = {"m_filter","0", true}; diff --git a/common/vid_x.c b/common/vid_x.c index 4d67f99..b686078 100644 --- a/common/vid_x.c +++ b/common/vid_x.c @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // vid_x.c -- general x video driver #define _BSD +#include "config.h" #include #include @@ -55,6 +56,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include +#ifdef HAVE_STRINGS_H +#include +#endif + cvar_t _windowed_mouse = {"_windowed_mouse","0", true}; cvar_t m_filter = {"m_filter","0", true}; diff --git a/configure.in b/configure.in index 9e2bf4f..8ab5968 100644 --- a/configure.in +++ b/configure.in @@ -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/soundcard.h linux/soundcard.h machine/soundcard.h sys/audioio.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. AC_PROG_GCC_TRADITIONAL @@ -39,6 +39,11 @@ AC_C_INLINE AC_HEADER_TIME AC_STRUCT_TM 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 !!! FIXME !!! Do some real check here... @@ -91,6 +96,10 @@ AC_ARG_ENABLE(alsa, [ --enable-alsa enable alsa support], ) +AC_ARG_ENABLE(zlib, +[ --enable-zlib enable zlib support], +) + dnl Checks for stricmp/strcasecmp AC_CHECK_FUNC(stricmp,, AC_CHECK_FUNC(strcasecmp, AC_DEFINE(stricmp,strcasecmp))) @@ -114,9 +123,21 @@ fi dnl Checks for working -lm 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 -AC_CHECK_LIB(z, gzopen, LIBS="$LIBS -lz" - HAS_ZLIB=yes, HAS_ZLIB=no, [$LIBS]) +dnl Note - must have gztell *and* gzgets in -lz *and* zlib.h +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 (XoXus: Since vid_x.c relies on XShm being there, this now disables @@ -492,10 +513,6 @@ case "${target}" in i?86-*-*) INTEL_ARCH=yes AC_MSG_RESULT(yes) - ;; - *) AC_MSG_RESULT(no) -esac - AC_MSG_CHECKING(to see if we should disable x86 optimizations) AC_ARG_ENABLE(asmopt, [ --disable-asmopt Disable assembler optimization (on ia32 machines)], @@ -506,6 +523,11 @@ if test "x$NO_ASMOPT" = xyes; then else AC_MSG_RESULT(no) fi + ;; + *) AC_MSG_RESULT(no) + NO_ASMOPT=yes +esac + dnl Check for sound libraries AC_CHECK_LIB(mme,waveOutOpen,HAVE_LIBMME=yes) diff --git a/qw_server/server.h b/qw_server/server.h index 549b16a..bd89ffa 100644 --- a/qw_server/server.h +++ b/qw_server/server.h @@ -24,7 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _SERVER_H #define _SERVER_H +#include "config.h" + +#ifdef HAS_ZLIB #include +#else +#include "nozip.h" +#endif #include diff --git a/qw_server/sv_main.c b/qw_server/sv_main.c index fbe7ec8..8cd7882 100644 --- a/qw_server/sv_main.c +++ b/qw_server/sv_main.c @@ -23,6 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "qwsvdef.h" +#ifdef HAVE_STRINGS_H +#include +#endif + quakeparms_t host_parms; qboolean host_initialized; // true if into command execution (compatability) diff --git a/qw_server/sys_unix.c b/qw_server/sys_unix.c index aab72d9..4dd70a4 100644 --- a/qw_server/sys_unix.c +++ b/qw_server/sys_unix.c @@ -36,6 +36,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #endif +#ifdef HAVE_STRINGS_H +#include +#endif + extern cvar_t sys_nostdout; cvar_t sys_extrasleep = {"sys_extrasleep","0"};