handle alloca properly

This commit is contained in:
Bill Currie 2003-07-09 06:28:09 +00:00
parent 84e071d235
commit 855fc53709
7 changed files with 72 additions and 24 deletions

View file

@ -260,6 +260,41 @@ AC_TRY_LINK(
) )
AM_CONDITIONAL(BUILD_FNMATCH, test "$BUILD_FNMATCH" = "yes") AM_CONDITIONAL(BUILD_FNMATCH, test "$BUILD_FNMATCH" = "yes")
AC_MSG_CHECKING(for alloca in stdlib.h)
AC_TRY_COMPILE(
[#include <stdlib.h>],
[void *(*foo)(size_t) = alloca;],
have_alloca_proto=yes
AC_MSG_RESULT(yes),
have_alloca_proto=no
AC_MSG_RESULT(no)
)
if test "$have_alloca_proto" = no -a "$ac_cv_header_alloca_h" = yes; then
AC_MSG_CHECKING(for alloca in alloca.h)
AC_TRY_COMPILE(
[#include <stdlib.h>]
[#include <alloca.h>],
[void *(*foo)(size_t) = alloca;],
have_alloca_proto=yes
AC_MSG_RESULT(yes),
have_alloca_proto=no
AC_MSG_RESULT(no)
)
fi
if test "$have_alloca_proto" = yes; then
AC_DEFINE(HAVE_ALLOCA_PROTO)
fi
AH_VERBATIM([HAVE_ALLOCA_PROTO],
[/* Define this if alloca is prototyped */
#undef HAVE_ALLOCA_PROTO
#ifndef HAVE_ALLOCA_PROTO
#ifndef QFASM
void *alloca (int size);
#endif
#endif])
AC_MSG_CHECKING(for fnmatch in fnmatch.h) AC_MSG_CHECKING(for fnmatch in fnmatch.h)
AC_TRY_COMPILE( AC_TRY_COMPILE(
[#include "fnmatch.h"], [#include "fnmatch.h"],
@ -1438,6 +1473,7 @@ else
plugin_ldflags= plugin_ldflags=
plugin_libadd= plugin_libadd=
fi fi
ASFLAGS="$ASFLAGS -DQFASM"
CCASFLAGS="$ASFLAGS" CCASFLAGS="$ASFLAGS"
CCAS="$AS" CCAS="$AS"
AC_SUBST(AS) AC_SUBST(AS)

View file

@ -48,10 +48,6 @@ static __attribute__ ((unused)) const char rcsid[] =
#include "compat.h" #include "compat.h"
#include "snd_render.h" #include "snd_render.h"
#ifdef _WIN32
void *alloca(size_t size);
#endif
#define SAMPLE_GAP 4 #define SAMPLE_GAP 4
typedef struct { typedef struct {

View file

@ -1,3 +1,39 @@
/*
packfile.c
pak file support
Copyright (C) 2003 #AUTHOR#
Author: #AUTHOR#
Date: #DATE#
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
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
static __attribute__ ((unused)) const char rcsid[] =
"$Id$";
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <limits.h> #include <limits.h>
@ -11,10 +47,6 @@
#include "QF/pakfile.h" #include "QF/pakfile.h"
#include "QF/qendian.h" #include "QF/qendian.h"
#ifdef _WIN32
void *alloca(size_t size);
#endif
static const char * static const char *
pack_get_key (void *p, void *unused) pack_get_key (void *p, void *unused)
{ {

View file

@ -95,10 +95,6 @@ static __attribute__ ((unused)) const char rcsid[] =
int fnmatch (const char *__pattern, const char *__string, int __flags); int fnmatch (const char *__pattern, const char *__string, int __flags);
#endif #endif
#ifdef _WIN32
void *alloca(size_t size);
#endif
/* /*
All of Quake's data access is through a hierchical file system, but the All of Quake's data access is through a hierchical file system, but the
contents of the file system can be transparently merged from several contents of the file system can be transparently merged from several

View file

@ -43,10 +43,6 @@ static __attribute__ ((unused)) const char rcsid[] =
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef _WIN32
void *alloca(size_t size);
#endif
#include "QF/dstring.h" #include "QF/dstring.h"
#include "QF/qendian.h" #include "QF/qendian.h"
#include "QF/riff.h" #include "QF/riff.h"

View file

@ -59,10 +59,6 @@ static __attribute__ ((unused)) const char rcsid[] =
#include "compat.h" #include "compat.h"
#ifdef _WIN32
void *alloca(size_t size);
#endif
#define BOX_WIDTH 2056 #define BOX_WIDTH 2056
/* cube face to sky texture offset conversion */ /* cube face to sky texture offset conversion */

View file

@ -44,10 +44,6 @@ static __attribute__ ((unused)) const char rcsid[] =
# include <alloca.h> # include <alloca.h>
#endif #endif
#ifdef _WIN32
void *alloca(size_t size);
#endif
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>