verifier la taille de pile avant de compiler opt.opt
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5061 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
fe2626f7a5
commit
9ff16b672c
14
Makefile
14
Makefile
|
@ -29,7 +29,8 @@ CAMLRUN=byterun/ocamlrun
|
|||
SHELL=/bin/sh
|
||||
MKDIR=mkdir -p
|
||||
|
||||
INCLUDES=-I utils -I parsing -I typing -I bytecomp -I asmcomp -I driver -I toplevel
|
||||
INCLUDES=-I utils -I parsing -I typing -I bytecomp -I asmcomp -I driver \
|
||||
-I toplevel
|
||||
|
||||
UTILS=utils/misc.cmo utils/tbl.cmo utils/config.cmo \
|
||||
utils/clflags.cmo utils/terminfo.cmo utils/ccomp.cmo utils/warnings.cmo
|
||||
|
@ -222,7 +223,7 @@ opt-core:runtimeopt ocamlopt libraryopt
|
|||
opt: runtimeopt ocamlopt libraryopt otherlibrariesopt camlp4opt
|
||||
|
||||
# Native-code versions of the tools
|
||||
opt.opt: core ocaml opt-core ocamlc.opt otherlibraries camlp4out \
|
||||
opt.opt: checkstack core ocaml opt-core ocamlc.opt otherlibraries camlp4out \
|
||||
$(DEBUGGER) ocamldoc ocamlopt.opt otherlibrariesopt \
|
||||
camlp4opt ocamllex.opt ocamltoolsopt.opt camlp4optopt ocamldoc.opt
|
||||
|
||||
|
@ -604,6 +605,15 @@ partialclean::
|
|||
alldepend::
|
||||
cd camlp4; $(MAKE) depend
|
||||
|
||||
# Check that the stack limit is reasonable.
|
||||
|
||||
checkstack:
|
||||
@if $(BYTECC) -o tools/checkstack tools/checkstack.c; \
|
||||
then tools/checkstack; \
|
||||
else :; \
|
||||
fi
|
||||
@rm -f tools/checkstack
|
||||
|
||||
# Default rules
|
||||
|
||||
.SUFFIXES: .ml .mli .cmo .cmi .cmx
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/***********************************************************************/
|
||||
/* */
|
||||
/* Objective Caml */
|
||||
/* */
|
||||
/* Damien Doligez, projet Moscova, INRIA Rocquencourt */
|
||||
/* */
|
||||
/* Copyright 2002 Institut National de Recherche en Informatique et */
|
||||
/* en Automatique. All rights reserved. This file is distributed */
|
||||
/* under the terms of the GNU Library General Public License, with */
|
||||
/* the special exception on linking described in file ../../LICENSE. */
|
||||
/* */
|
||||
/***********************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#define MINSTACKBYTES (512 * 1024 * sizeof (long))
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
struct rlimit limit;
|
||||
int rc;
|
||||
|
||||
rc = getrlimit (RLIMIT_STACK, &limit);
|
||||
if (rc != 0) exit (0);
|
||||
if (limit.rlim_cur < MINSTACKBYTES){
|
||||
fprintf (stderr,
|
||||
"\nThe current stack size limit is too low (%luk)\n"
|
||||
"You must increase it with one of the following commands:\n"
|
||||
"Under sh, bash, zsh: ulimit -s %lu\n"
|
||||
"Under csh, tcsh: limit stacksize %lu\n\n",
|
||||
(unsigned long) (limit.rlim_cur / 1024),
|
||||
MINSTACKBYTES / 1024, MINSTACKBYTES / 1024);
|
||||
exit (3);
|
||||
}
|
||||
exit (0);
|
||||
}
|
Loading…
Reference in New Issue