mingw cross compile fixes. qw-server (only, so far) compiles but does not

yet link due to Sys_Error :/
This commit is contained in:
Bill Currie 2001-04-10 20:07:11 +00:00
parent 5ebe111301
commit dfbfd9463c
19 changed files with 215 additions and 98 deletions

View file

@ -452,16 +452,18 @@ AC_SUBST(SVGA_CFLAGS)
AC_SUBST(SVGA_LIBS) AC_SUBST(SVGA_LIBS)
dnl Checks for X11 and XShm dnl Checks for X11 and XShm
AC_PATH_XTRA if test "x$mingw" != xyes; then
if test "x$no_x" = x; then AC_PATH_XTRA
HAVE_X=yes if test "x$no_x" = x; then
AC_CHECK_LIB(Xext, XShmQueryExtension, HAVE_X=yes
X_SHM_LIB=-lXext, AC_CHECK_LIB(Xext, XShmQueryExtension,
HAVE_X=no, X_SHM_LIB=-lXext,
[ $X_LIBS -lX11 $X_EXTRA_LIBS ] HAVE_X=no,
) [ $X_LIBS -lX11 $X_EXTRA_LIBS ]
)
fi
AC_SUBST(X_SHM_LIB)
fi fi
AC_SUBST(X_SHM_LIB)
dnl Check for XFree86-VidMode support dnl Check for XFree86-VidMode support
AC_ARG_ENABLE(vidmode, AC_ARG_ENABLE(vidmode,
@ -571,7 +573,7 @@ if test "x$HAVE_GLX" != xno; then
fi fi
CPPFLAGS="$save_CPPFLAGS" CPPFLAGS="$save_CPPFLAGS"
dnl Make sure -lGL or -lMesaGL works dnl Make sure -lGL or -lMesaGL or -lopengl32 works
if test "x$glx_libraries" != xauto -a "x$glx_libraries" != xno -a "x$glx_libraries" != x; then if test "x$glx_libraries" != xauto -a "x$glx_libraries" != xno -a "x$glx_libraries" != x; then
if test "x$HAVE_GLX" = xyes; then if test "x$HAVE_GLX" = xyes; then
HAVE_GLX=no HAVE_GLX=no
@ -587,6 +589,13 @@ if test "x$glx_libraries" != xauto -a "x$glx_libraries" != xno -a "x$glx_librari
[ -L$glx_libraries -lX11 $X_EXTRA_LIBS ] [ -L$glx_libraries -lX11 $X_EXTRA_LIBS ]
) )
fi fi
if test "x$HAVE_GLX" != xyes; then
AC_CHECK_LIB(opengl32, glColor4f,
HAVE_GLX=yes
OGL_NAME=opengl32,,
[ -L$glx_libraries ]
)
fi
fi fi
else else
if test "x$glx_libraries" != xauto \ if test "x$glx_libraries" != xauto \
@ -609,6 +618,20 @@ else
[ $X_LIBS -lX11 $X_EXTRA_LIBS ] [ $X_LIBS -lX11 $X_EXTRA_LIBS ]
) )
fi fi
if test "x$HAVE_GLX" != xyes; then
LIBS_save="$LIBS"
LIBS="$LIBS -lopengl32"
AC_MSG_CHECKING(for glColor4f in -lopengl32)
AC_TRY_LINK(
[#include <GL/gl.h>],
[glColor4f(0,0,0,0);],
HAVE_GLX=yes
OGL_NAME=opengl32
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
LIBS="$LIBS_save"
fi
fi fi
fi fi
@ -1269,7 +1292,7 @@ dnl ==================================================================
AC_ARG_WITH(clients, AC_ARG_WITH(clients,
[ --with-clients=<list> compile clients in <list>; [ --with-clients=<list> compile clients in <list>;
3dfx,fbdev,glx,mgl,sdl,sgl,svga,x11], 3dfx,fbdev,glx,mgl,sdl,sgl,svga,wgl,x11],
clients="$withval", clients="$withval",
clients="all" clients="all"
) )
@ -1281,6 +1304,7 @@ if test "$clients" = "all"; then
ENABLE_SDL=yes ENABLE_SDL=yes
ENABLE_SGL=yes ENABLE_SGL=yes
ENABLE_SVGA=yes ENABLE_SVGA=yes
ENABLE_WGL=yes
ENABLE_X11=yes ENABLE_X11=yes
else else
ENABLE_3DFX=no ENABLE_3DFX=no
@ -1290,6 +1314,7 @@ else
ENABLE_SDL=no ENABLE_SDL=no
ENABLE_SGL=no ENABLE_SGL=no
ENABLE_SVGA=no ENABLE_SVGA=no
ENABLE_WGL=no
ENABLE_X11=no ENABLE_X11=no
IFS="," IFS=","
for client in $clients; do for client in $clients; do
@ -1315,6 +1340,9 @@ else
svga) svga)
ENABLE_SVGA=yes ENABLE_SVGA=yes
;; ;;
wgl)
ENABLE_WGL=yes
;;
x11) x11)
ENABLE_X11=yes ENABLE_X11=yes
;; ;;
@ -1370,6 +1398,11 @@ if test "x$HAVE_SVGA" = xyes -a "x$ENABLE_SVGA" = xyes; then
NQ_TARGETS="$NQ_TARGETS nq-svga\$(EXEEXT)" NQ_TARGETS="$NQ_TARGETS nq-svga\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS SVGAlib" CL_TARGETS="$CL_TARGETS SVGAlib"
fi fi
if test "x$mingw" = xyes -a "x$HAVE_GLX" = xyes -a "x$ENABLE_WGL" = xyes; then
QW_TARGETS="$QW_TARGETS qw-client-wgl\$(EXEEXT)"
NQ_TARGETS="$NQ_TARGETS nq-wgl\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS WGL"
fi
if test "x$HAVE_X" = xyes -a "x$ENABLE_X11" = xyes; then if test "x$HAVE_X" = xyes -a "x$ENABLE_X11" = xyes; then
QW_TARGETS="$QW_TARGETS qw-client-x11\$(EXEEXT)" QW_TARGETS="$QW_TARGETS qw-client-x11\$(EXEEXT)"
NQ_TARGETS="$NQ_TARGETS nq-x11\$(EXEEXT)" NQ_TARGETS="$NQ_TARGETS nq-x11\$(EXEEXT)"

147
include/winquake.h Normal file
View file

@ -0,0 +1,147 @@
/*
winquake.h
(description)
Copyright (C) 1996-1997 Id Software, Inc.
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:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
#ifndef _WINQUAKE_H
#define _WINQUAKE_H
#ifdef _WIN32
#ifndef __GNUC__
# pragma warning( disable : 4229 ) /* mgraph gets this */
#endif
#define byte __hide_byte
#define LPCWAVEFORMATEX __hide_LPCWAVEFORMATEX
#include <windows.h>
#undef LPCWAVEFORMATEX
#ifdef WINNT
#undef WINNT
#include <dsound.h>
#include <ddraw.h>
#define WINNT
#else
#include <windows.h>
#include <dsound.h>
#include <ddraw.h>
#endif
#ifdef HAVE_MGRAPH_H
# include <mgraph.h>
#endif
#undef byte
#include "QF/qtypes.h"
#ifndef WM_MOUSEWHEEL
# define WM_MOUSEWHEEL 0x020A
#endif
extern HINSTANCE global_hInstance;
extern int global_nCmdShow;
extern LPDIRECTDRAW lpDD;
extern qboolean DDActive;
extern LPDIRECTDRAWSURFACE lpPrimary;
extern LPDIRECTDRAWSURFACE lpFrontBuffer;
extern LPDIRECTDRAWSURFACE lpBackBuffer;
extern LPDIRECTDRAWPALETTE lpDDPal;
extern LPDIRECTSOUND pDS;
extern LPDIRECTSOUNDBUFFER pDSBuf;
extern DWORD gSndBufSize;
void VID_LockBuffer (void);
void VID_UnlockBuffer (void);
typedef enum {MS_WINDOWED, MS_FULLSCREEN, MS_FULLDIB, MS_UNINIT} modestate_t;
extern modestate_t modestate;
extern HWND mainwindow;
extern qboolean ActiveApp, Minimized;
extern qboolean WinNT;
int VID_ForceUnlockedAndReturnState (void);
void VID_ForceLockState (int lk);
/*
void IN_ShowMouse (void);
void IN_DeactivateMouse (void);
void IN_HideMouse (void);
void IN_ActivateMouse (void);
void IN_RestoreOriginalMouseState (void);
void IN_SetQuakeMouseState (void);
void IN_MouseEvent (int mstate);
*/
extern qboolean winsock_lib_initialized;
extern int window_center_x, window_center_y;
extern RECT window_rect;
extern qboolean mouseinitialized;
#ifdef SPLASH_SCREEN
extern HWND hwnd_dialog;
#endif
extern HANDLE hinput, houtput;
void IN_UpdateClipCursor (void);
void CenterWindow(HWND hWndCenter, int width, int height, BOOL lefttopjustify);
void S_BlockSound (void);
void S_UnblockSound (void);
DWORD *DSOUND_LockBuffer(qboolean lockit);
void DSOUND_ClearBuffer(int clear);
void DSOUND_Restore(void);
void VID_SetDefaultMode (void);
int (PASCAL FAR *pWSAStartup)(WORD wVersionRequired, LPWSADATA lpWSAData);
int (PASCAL FAR *pWSACleanup)(void);
int (PASCAL FAR *pWSAGetLastError)(void);
SOCKET (PASCAL FAR *psocket)(int af, int type, int protocol);
int (PASCAL FAR *pioctlsocket)(SOCKET s, long cmd, u_long FAR *argp);
int (PASCAL FAR *psetsockopt)(SOCKET s, int level, int optname,
const char FAR * optval, int optlen);
int (PASCAL FAR *precvfrom)(SOCKET s, char FAR * buf, int len, int flags,
struct sockaddr FAR *from, int FAR * fromlen);
int (PASCAL FAR *psendto)(SOCKET s, const char FAR * buf, int len, int flags,
const struct sockaddr FAR *to, int tolen);
int (PASCAL FAR *pclosesocket)(SOCKET s);
int (PASCAL FAR *pgethostname)(char FAR * name, int namelen);
struct hostent FAR * (PASCAL FAR *pgethostbyname)(const char FAR * name);
struct hostent FAR * (PASCAL FAR *pgethostbyaddr)(const char FAR * addr,
int len, int type);
int (PASCAL FAR *pgetsockname)(SOCKET s, struct sockaddr FAR *name,
int FAR * namelen);
#endif /* _WIN32 */
#endif /* _WINQUAKE_H */

View file

@ -38,6 +38,12 @@
#include <stdlib.h> #include <stdlib.h>
#ifdef _WIN32
#include "winquake.h"
//#include "in_win.h"
void IN_Accumulate (void);//XXX FIXME
#endif
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/model.h" #include "QF/model.h"
@ -45,11 +51,6 @@
#include "QF/sys.h" #include "QF/sys.h"
#include "QF/sound.h" #include "QF/sound.h"
#ifdef _WIN32
#include "winquake.h"
#include "in_win.h"
#endif
void S_Play (void); void S_Play (void);
void S_PlayVol (void); void S_PlayVol (void);
void S_SoundList (void); void S_SoundList (void);

View file

@ -36,8 +36,10 @@
# include <strings.h> # include <strings.h>
#endif #endif
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h>
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/crc.h" #include "QF/crc.h"
#include "QF/cvar.h" #include "QF/cvar.h"

View file

@ -38,6 +38,7 @@
#include <stdarg.h> #include <stdarg.h>
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/progs.h" #include "QF/progs.h"

View file

@ -38,6 +38,7 @@
#include <stdarg.h> #include <stdarg.h>
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/sys.h" #include "QF/sys.h"

View file

@ -33,7 +33,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include "QF/compat.h"
#include "QF/qtypes.h" #include "QF/qtypes.h"
#include "QF/va.h"
/* /*
va va

View file

@ -90,29 +90,6 @@ Sys_DebugLog (char *file, char *fmt, ...)
close (fd); close (fd);
}; };
/*
FILE IO
*/
int
Sys_FileTime (char *path)
{
QFile *f;
int t, retval;
f = Qopen (path, "rb");
if (f) {
Qclose (f);
retval = 1;
} else {
retval = -1;
}
return retval;
}
/* /*
SYSTEM IO SYSTEM IO
*/ */

View file

@ -39,6 +39,7 @@
#include <windows.h> #include <windows.h>
#include "client.h" #include "client.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "host.h" #include "host.h"
#include "QF/qargs.h" #include "QF/qargs.h"
@ -115,28 +116,6 @@ wfilelength (QFile *f)
} }
int
Sys_FileTime (char *path)
{
QFile *f;
int t, retval;
t = VID_ForceUnlockedAndReturnState ();
f = Qopen (path, "rb");
if (f) {
Qclose (f);
retval = 1;
} else {
retval = -1;
}
VID_ForceLockState (t);
return retval;
}
/* /*
SYSTEM IO SYSTEM IO
*/ */
@ -215,7 +194,7 @@ Sys_Init (void)
void void
Sys_Error (char *error, ...) Sys_Error (const char *error, ...)
{ {
va_list argptr; va_list argptr;
char text[1024]; // , text2[1024]; char text[1024]; // , text2[1024];

View file

@ -43,6 +43,7 @@
#include "cl_input.h" #include "cl_input.h"
#include "client.h" #include "client.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "host.h" #include "host.h"

View file

@ -43,6 +43,7 @@
#include "QF/checksum.h" #include "QF/checksum.h"
#include "QF/compat.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/model.h" #include "QF/model.h"
#include "QF/qendian.h" #include "QF/qendian.h"

View file

@ -45,7 +45,7 @@
#include <stdarg.h> #include <stdarg.h>
#include "client.h" #include "client.h"
//#include "commdef.h" #include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/msg.h" #include "QF/msg.h"

View file

@ -68,6 +68,7 @@
# include <libc.h> # include <libc.h>
#endif #endif
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/msg.h" #include "QF/msg.h"
#include "net.h" #include "net.h"

View file

@ -37,6 +37,7 @@
#endif #endif
#include "QF/crc.h" #include "QF/crc.h"
#include "QF/compat.h"
#include "QF/msg.h" #include "QF/msg.h"
#include "QF/quakefs.h" #include "QF/quakefs.h"
#include "server.h" #include "server.h"

View file

@ -34,6 +34,7 @@
#endif #endif
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/msg.h" #include "QF/msg.h"
#include "server.h" #include "server.h"
#include "sv_pr_cmds.h" #include "sv_pr_cmds.h"

View file

@ -38,6 +38,7 @@
#include <time.h> #include <time.h>
#include "bothdefs.h" #include "bothdefs.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/msg.h" #include "QF/msg.h"
#include "server.h" #include "server.h"

View file

@ -35,6 +35,7 @@
#include <winsock.h> #include <winsock.h>
#include <conio.h> #include <conio.h>
#include "QF/compat.h"
#include "QF/qargs.h" #include "QF/qargs.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "server.h" #include "server.h"
@ -49,29 +50,12 @@ char *svs_info = svs.info;
extern cvar_t *sys_nostdout; extern cvar_t *sys_nostdout;
cvar_t *sys_sleep; cvar_t *sys_sleep;
/*
Sys_FileTime
*/
int
Sys_FileTime (char *path)
{
QFile *f;
f = Qopen (path, "rb");
if (f) {
Qclose (f);
return 1;
}
return -1;
}
/* /*
Sys_Error Sys_Error
*/ */
void void
Sys_Error (char *error, ...) Sys_Error (const char *error, ...)
{ {
va_list argptr; va_list argptr;
char text[1024]; char text[1024];

View file

@ -117,23 +117,6 @@ Sys_Printf (char *fmt, ...)
} }
/*
Sys_FileTime
returns -1 if not present
*/
int
Sys_FileTime (char *path)
{
struct stat buf;
if (stat (path, &buf) == -1)
return -1;
return buf.st_mtime;
}
/* /*
Sys_mkdir Sys_mkdir
*/ */

View file

@ -34,6 +34,7 @@
#include <direct.h> #include <direct.h>
#include <windows.h> #include <windows.h>
#include "QF/compat.h"
#include "server.h" #include "server.h"
cvar_t *sys_nostdout; cvar_t *sys_nostdout;