- Applied NetBSD patch from Quentin Garnier.

- Added a configure test for ossaudio for NetBSD.
- Added a configure test for POSIX threads, from the GNU
  autoconf macro repository.
- Fixed up some typos in the Rogue and Xatrix makefiles
This commit is contained in:
Jamie Wilkinson 2002-07-04 14:17:24 +00:00
parent 9873502b19
commit 8ccc351f99
13 changed files with 251 additions and 79 deletions

View file

@ -228,3 +228,192 @@ int main (int argc, char *argv[])
AC_SUBST(SDL_LIBS)
rm -f conf.sdltest
])
dnl ACX_PTHREAD macro by Steven G. Johnson <stevenj@alum.mit.edu> and
dnl Alejandro Forero Cuervo <bachue@bachue.com>. Found at:
dnl http://www.gnu.org/software/ac-archive/Installed_Packages/acx_pthread.html
AC_DEFUN([ACX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
acx_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
AC_MSG_RESULT($acx_pthread_ok)
if test x"$acx_pthread_ok" = xno; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all.
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# pthread: Linux, etcetera
# --thread-safe: KAI C++
case "${host_cpu}-${host_os}" in
*solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthread or
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
;;
esac
if test x"$acx_pthread_ok" = xno; then
for flag in $acx_pthread_flags; do
case $flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_TRY_LINK([#include <pthread.h>],
[pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
[acx_pthread_ok=yes])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($acx_pthread_ok)
if test "x$acx_pthread_ok" = xyes; then
break;
fi
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$acx_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: threads are created detached by default
# and the JOINABLE attribute has a nonstandard name (UNDETACHED).
AC_MSG_CHECKING([for joinable pthread attribute])
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_JOINABLE;],
ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
if test x"$ok" = xunknown; then
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_UNDETACHED;],
ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
fi
if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
[Define to the necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_RESULT(${ok})
if test x"$ok" = xunknown; then
AC_MSG_WARN([we do not know how to create joinable pthreads])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case "${host_cpu}-${host_os}" in
*-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
*solaris* | alpha*-osf*) flag="-D_REENTRANT";;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with cc_r
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
else
PTHREAD_CC="$CC"
fi
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CC)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$acx_pthread_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
:
else
acx_pthread_ok=no
$2
fi
])dnl ACX_PTHREAD

View file

@ -49,6 +49,14 @@ dnl --------------------
dnl Checks for libraries
dnl --------------------
dnl Check for ossaudio on NetBSD
OSS_LIBS=""
AC_CHECK_LIB([ossaudio], [_oss_ioctl], [OSS_LIBS="-lossaudio"])
AC_SUBST(OSS_LIBS)
dnl Check for POSIX threads
ACX_PTHREAD(,AC_MSG_ERROR(["POSIX threads required!"]))
dnl Check for SVGAlib
AC_ARG_WITH(svgalib,
[ --with-svgalib=DIR use SVGAlib found in DIR],

View file

@ -2,9 +2,8 @@
SUBDIRS = . baseq2 ctf xatrix rogue
ALL_CFLAGS = -Wall -Werror -pipe
AM_LDFLAGS = -module -avoid-version -rpath $(pkglibdir)
#AM_LDFLAGS = -shared
std_cflags = -Wall -Werror -pipe
module_ldflags = -module -avoid-version -rpath $(pkglibdir)
bin_PROGRAMS = quake2
pkglib_PROGRAMS = @VID_REFS@
@ -52,29 +51,35 @@ quake2_SOURCES = main.c q_sh.c vid_menu.c vid_so.c glob.c net_udp.c \
m_flash.c
# \
# #snd_mixa.S
quake2_CFLAGS = $(ALL_CFLAGS) @INCLTDL@
quake2_LDFLAGS = -lm -pthread
quake2_LDADD = @LIBLTDL@
quake2_CFLAGS = $(std_cflags) @INCLTDL@ @PTHREAD_CFLAGS@
# the macro puts -pthread into cflags, but we want to link
# with this flag too, so stick it into the ldflags if it's there...
# extra cflags at link time can't hurt
quake2_LDFLAGS = @PTHREAD_CFLAGS@
quake2_LDADD = @PTHREAD_LIBS@ @LIBLTDL@ @OSS_LIBS@ -lm
# ref_glx
if BUILD_GLX
ref_glx_la_SOURCES = $(REF_GL_COMMON) gl_glx.c
ref_glx_la_CFLAGS = $(ALL_CFLAGS) -fPIC @X_CFLAGS@ @OPENGL_CFLAGS@
ref_glx_la_CFLAGS = $(std_cflags) -fPIC @X_CFLAGS@ @OPENGL_CFLAGS@
ref_glx_la_LDADD = @X_PRE_LIBS@ @X_LIBS@ @XTRA_LIBS@ @X_EXTRA_LIBS@ @OPENGL_LIBS@ @DL_LIBS@
ref_glx_la_LDFLAGS = $(module_ldflags)
endif
# ref_tdfx
if BUILD_TDFX
ref_tdfx_la_SOURCES = $(REF_GL_COMMON) rw_in_svgalib.c gl_fxmesa.c
ref_tdfx_la_CFLAGS = $(ALL_CFLAGS) -fPIC @GLIDE_CFLAGS@ @X_CFLAGS@ @SVGALIB_CFLAGS@
ref_tdfx_la_CFLAGS = $(std_cflags) -fPIC @GLIDE_CFLAGS@ @X_CFLAGS@ @SVGALIB_CFLAGS@
ref_tdfx_la_LDADD = @GLIDE_LIBS@ @X_LIBS@ @SVGALIB_LIBS@
ref_tdfx_la_LDFLAGS = $(module_ldflags)
endif
# ref_sdlgl
if BUILD_SDLGL
ref_sdlgl_la_SOURCES = $(REF_GL_COMMON) rw_sdl.c
ref_sdlgl_la_CFLAGS = $(ALL_CFLAGS) -fPIC -DOPENGL @SDL_CFLAGS@ @OPENGL_CFLAGS@
ref_sdlgl_la_CFLAGS = $(std_cflags) -fPIC -DOPENGL @SDL_CFLAGS@ @OPENGL_CFLAGS@
ref_sdlgl_la_LDADD = @SDL_LIBS@ @OPENGL_LIBS@
ref_sdlgl_la_LDFLAGS = $(module_ldflags)
endif
# ref_soft
@ -86,20 +91,23 @@ DCOPY_S =
endif
ref_soft_la_SOURCES = $(REF_SOFT_COMMON) $(REF_SOFT_ASM) $(DCOPY_S) \
rw_svgalib.c rw_in_svgalib.c
ref_soft_la_CFLAGS = $(ALL_CFLAGS) -fPIC @SVGALIB_CFLAGS@
ref_soft_la_CFLAGS = $(std_cflags) -fPIC @SVGALIB_CFLAGS@
ref_soft_la_LDADD = @SVGALIB_LIBS@
ref_soft_la_LDFLAGS = $(module_ldflags)
endif
# ref_softx
if BUILD_SOFTX
ref_softx_la_SOURCES = $(REF_SOFT_COMMON) $(REF_SOFT_ASM) rw_x11.c
ref_softx_la_CFLAGS = $(ALL_CFLAGS) -fPIC @X_CFLAGS@
ref_softx_la_CFLAGS = $(std_cflags) -fPIC @X_CFLAGS@
ref_softx_la_LDADD = @X_PRE_LIBS@ @X_LIBS@ @XTRA_LIBS@ @X_EXTRA_LIBS@
ref_softx_la_LDFLAGS = $(module_ldflags)
endif
# ref_softsdl
if BUILD_SOFTSDL
ref_softsdl_la_SOURCES = $(REF_SOFT_COMMON) $(REF_SOFT_ASM) rw_sdl.c
ref_softsdl_la_CFLAGS = $(ALL_CFLAGS) -fPIC @SDL_CFLAGS@
ref_softsdl_la_CFLAGS = $(std_cflags) -fPIC @SDL_CFLAGS@
ref_softsdl_la_LDADD = @SDL_LIBS@
ref_softsdl_la_LDFLAGS = $(module_ldflags)
endif

View file

@ -4,54 +4,17 @@
pkglibdir=$(libdir)/@PACKAGE@/baseq2
pkglib_LTLIBRARIES = game.la
game_la_SOURCES = g_ai.c \
p_client.c \
g_chase.c \
g_cmds.c \
g_svcmds.c \
g_combat.c \
g_func.c \
g_items.c \
g_main.c \
g_misc.c \
g_monster.c \
g_phys.c \
g_save.c \
g_spawn.c \
g_target.c \
g_trigger.c \
g_turret.c \
g_utils.c \
g_weapon.c \
m_actor.c \
m_berserk.c \
m_boss2.c \
m_boss3.c \
m_boss31.c \
m_boss32.c \
m_brain.c \
m_chick.c \
m_flipper.c \
m_float.c \
m_flyer.c \
m_gladiator.c \
m_gunner.c \
m_hover.c \
m_infantry.c \
m_insane.c \
m_medic.c \
m_move.c \
m_mutant.c \
m_parasite.c \
m_soldier.c \
m_supertank.c \
m_tank.c \
p_hud.c \
p_trail.c \
p_view.c \
p_weapon.c \
q_shared.c \
m_flash.c
game_la_SOURCES = g_ai.c g_chase.c g_cmds.c g_svcmds.c g_combat.c \
g_func.c g_items.c g_main.c g_misc.c g_monster.c \
g_phys.c g_save.c g_spawn.c g_target.c g_trigger.c \
g_turret.c g_utils.c g_weapon.c \
m_actor.c m_berserk.c m_boss2.c m_boss3.c m_boss31.c \
m_boss32.c m_brain.c m_chick.c m_flipper.c m_float.c \
m_flyer.c m_gladiator.c m_gunner.c m_hover.c m_flash.c \
m_infantry.c m_insane.c m_medic.c m_move.c m_mutant.c \
m_parasite.c m_soldier.c m_supertank.c m_tank.c \
p_client.c p_hud.c p_trail.c p_view.c p_weapon.c \
q_shared.c
AM_CFLAGS = -fPIC -Wall -Werror -pipe
AM_CPPFLAGS = -I..

View file

@ -30,7 +30,7 @@
#ifndef __GLW_H__
#define __GLW_H__
#if defined __linux__ || defined __bsd__ || defined __sgi || defined __FreeBSD__
#if defined __linux__ || defined __bsd__ || defined __sgi || defined __FreeBSD__ || defined __NetBSD__
typedef struct
{

View file

@ -47,7 +47,7 @@
/* merged from sys_*.c -- jaq */
#if defined(__linux__) || defined(__sgi)
#include <mntent.h>
#elif defined(__FreeBSD__) || defined(__bsd__)
#elif defined(__FreeBSD__) || defined(__bsd__) || defined (__NetBSD__)
#include <fstab.h>
#elif defined(sun)
#include <sys/file.h>
@ -253,7 +253,6 @@ void *Sys_GetGameAPI (void *parms) {
snprintf(name, MAX_OSPATH, "%s",
game->string[0]?game->string:BASEDIRNAME);
snprintf(path, MAX_OSPATH, "./%s:"PKGLIBDIR"/%s", name, name);
Com_Printf("searchpath: %s\n", path);
lt_dlsetsearchpath(path);
/* load the module */

View file

@ -53,7 +53,7 @@ void *Hunk_Begin (int maxsize)
/* merged in from q_sh*.c -- jaq */
#if defined(__linux__)
membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
#elif defined(__FreeBSD__) || defined(__bsd__)
#elif defined(__FreeBSD__) || defined(__bsd__) || defined(__NetBSD__)
membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);
#elif defined(sun) || defined(__sgi)
membase = malloc(maxhunksize);

View file

@ -43,7 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define CPUSTRING "AXP"
#endif
*/
#elif defined(__linux__) || defined(__bsd__) || defined (__FreeBSD__)
#elif defined(__linux__) || defined(__bsd__) || defined (__FreeBSD__) || defined (__NetBSD__)
#define BUILDSTRING "Linux"
/*

View file

@ -70,7 +70,7 @@ static FILE * log_fp = NULL;
#endif
/* merged in from qgl_bsd.c -- jaq */
#if defined(__bsd__) || defined(__FreeBSD__)
#if defined(__bsd__) || defined(__FreeBSD__) || defined(__NetBSD__)
/*
//FX Mesa Functions
fxMesaContext (*qfxMesaCreateContext)(GLuint win, GrScreenResolution_t, GrScreenRefresh_t, const GLint attribList[]);
@ -3019,7 +3019,7 @@ void QGL_Shutdown( void )
qglVertexPointer = NULL;
qglViewport = NULL;
/* merged in from qgl_bsd.c -- jaq */
#if defined(__bsd__) || defined(__FreeBSD__)
#if defined(__bsd__) || defined(__FreeBSD__) || defined(__NetBSD__)
/*
qfxMesaCreateContext = NULL;
qfxMesaCreateBestContext = NULL;
@ -3039,7 +3039,7 @@ void QGL_Shutdown( void )
}
/* merged in from qgl_bsd.c -- jaq */
#if defined(__linux__) || defined (__FreeBSD__)
#if defined(__linux__) || defined (__FreeBSD__) || defined(__NetBSD__)
#define GPA( a ) dlsym( glw_state.OpenGLLib, a )
void *qwglGetProcAddress(char *symbol)
@ -3438,7 +3438,7 @@ qboolean QGL_Init( const char *dllname )
qglVertexPointer = dllVertexPointer = GPA( "glVertexPointer" );
qglViewport = dllViewport = GPA( "glViewport" );
/* merged in from qgl_bsd.c -- jaq */
#if defined(__bsd__) || defined(__FreeBSD__)
#if defined(__bsd__) || defined(__FreeBSD__) || defined(__NetBSD__)
/*
qfxMesaCreateContext = GPA("fxMesaCreateContext");
qfxMesaCreateBestContext = GPA("fxMesaCreateBestContext");

View file

@ -459,7 +459,7 @@ void APIENTRY Fake_glColorTableEXT( GLenum target, GLenum internalformat,
#endif // linux
#if defined(__linux__) || defined(__bsd__) || defined(__FreeBSD__)
#if defined(__linux__) || defined(__bsd__) || defined(__FreeBSD__) || defined(__NetBSD__)
extern void (*qgl3DfxSetPaletteEXT)(GLuint *);

View file

@ -3,7 +3,6 @@
if DO_ROGUE
pkglibdir=$(libdir)/@PACKAGE@/rogue
pkglib_LTLIBRARIES = game.la
game_la_SOURCES = dm_ball.c dm_tag.c \
g_ai.c g_chase.c g_cmds.c g_combat.c g_func.c \
g_items.c g_main.c g_misc.c g_monster.c g_newai.c \
@ -20,7 +19,7 @@ game_la_SOURCES = dm_ball.c dm_tag.c \
m_tank.c m_turret.c m_widow.c m_widow2.c \
p_client.c p_hud.c p_trail.c p_view.c p_weapon.c \
q_shared.c
#game_so_CFLAGS = -fPIC -Wall -Werror -pipe
game_so_CFLAGS = -I.. -fPIC -pipe
game_so_LDFLAGS = -module -avoid-version -rpath $(pkglibdir)
#game_la_CFLAGS = -fPIC -Wall -Werror -pipe
game_la_CFLAGS = -I.. -fPIC -pipe
game_la_LDFLAGS = -module -avoid-version -rpath $(pkglibdir)
endif # DO_ROGUE

View file

@ -38,8 +38,13 @@
#include <sys/wait.h>
#include <stdio.h>
/* some have sys/soundcard.h, others have just soundcard.h */
#ifdef HAVE_SYS_SOUNDCARD_H
# include <sys/soundcard.h> /* others might be just soundcard.h */
# include <sys/soundcard.h>
#endif
#ifdef HAVE_SOUNDCARD_H
# include <soundcard.h>
#endif
#else /* __sgi */
@ -99,6 +104,8 @@ void * thesound(void * arg) {
frags_sent &= (dma.samples * (dma.samplebits/8) / FRAGSIZE) - 1;
}
pthread_exit(0L);
/* Not reached */
return NULL;
}
qboolean SNDDMA_Init(void) {

View file

@ -3,7 +3,6 @@
if DO_XATRIX
pkglibdir=$(libdir)/@PACKAGE@/xatrix
pkglib_LTLIBRARIES = game.la
game_la_SOURCES = g_ai.c g_chase.c g_cmds.c g_combat.c g_func.c \
g_items.c g_main.c g_misc.c g_monster.c g_phys.c \
g_save.c g_spawn.c g_svcmds.c g_target.c g_trigger.c \
@ -17,7 +16,7 @@ game_la_SOURCES = g_ai.c g_chase.c g_cmds.c g_combat.c g_func.c \
m_parasite.c m_soldier.c m_supertank.c m_tank.c \
p_client.c p_hud.c p_trail.c p_view.c p_weapon.c \
q_shared.c
#game_so_CFLAGS = -fPIC -Wall -Werror -pipe
game_so_CFLAGS = -I.. -fPIC -pipe
game_so_LDFLAGS = -module -avoid-version -rpath $(pkglibdir)
#game_la_CFLAGS = -fPIC -Wall -Werror -pipe
game_la_CFLAGS = -I.. -fPIC -pipe
game_la_LDFLAGS = -module -avoid-version -rpath $(pkglibdir)
endif # DO_XATRIX