Imported from ../bash-1.14.7.tar.gz.
[platform/upstream/bash.git] / lib / tilde / memalloc.h
1 /* memalloc.h -- consolidate code for including alloca.h or malloc.h and
2    defining alloca. */
3
4 /* Copyright (C) 1993 Free Software Foundation, Inc.
5
6    This file is part of GNU Bash, the Bourne Again SHell.
7
8    Bash is free software; you can redistribute it and/or modify it under
9    the terms of the GNU General Public License as published by the Free
10    Software Foundation; either version 2, or (at your option) any later
11    version.
12
13    Bash is distributed in the hope that it will be useful, but WITHOUT ANY
14    WARRANTY; without even the implied warranty of MERCHANTABILITY or
15    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16    for more details.
17
18    You should have received a copy of the GNU General Public License along
19    with Bash; see the file COPYING.  If not, write to the Free Software
20    Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21
22 #if !defined (__MEMALLOC_H__)
23 #  define __MEMALLOC_H__
24
25 #if defined (sparc) && defined (sun) && !defined (HAVE_ALLOCA_H)
26 #  define HAVE_ALLOCA_H
27 #endif
28
29 #if defined (__GNUC__) && !defined (HAVE_ALLOCA)
30 #  define HAVE_ALLOCA
31 #endif
32
33 #if defined (HAVE_ALLOCA_H) && !defined (HAVE_ALLOCA)
34 #  define HAVE_ALLOCA
35 #endif /* HAVE_ALLOCA_H && !HAVE_ALLOCA */
36
37 #if !defined (BUILDING_MAKEFILE)
38
39 #if defined (__GNUC__)
40 #  undef alloca
41 #  define alloca __builtin_alloca
42 #else /* !__GNUC__ */
43 #  if defined (HAVE_ALLOCA_H)
44 #    if defined (IBMESA)
45 #      include <malloc.h>
46 #    else /* !IBMESA */
47 #      include <alloca.h>
48 #    endif /* !IBMESA */
49 #  else
50 extern char *alloca ();
51 #  endif /* !HAVE_ALLOCA_H */
52 #endif /* !__GNUC__ */
53
54 #endif /* !BUILDING_MAKEFILE */
55
56 #endif /* __MEMALLOC_H__ */