]>
Commit | Line | Data |
---|---|---|
726f6388 JA |
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 | ||
3185942a JA |
8 | Bash is free software: you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation, either version 3 of the License, or | |
11 | (at your option) any later version. | |
726f6388 | 12 | |
3185942a JA |
13 | Bash is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
726f6388 | 17 | |
3185942a JA |
18 | You should have received a copy of the GNU General Public License |
19 | along with Bash. If not, see <http://www.gnu.org/licenses/>. | |
20 | */ | |
726f6388 | 21 | |
ccc6cda3 JA |
22 | #if !defined (_MEMALLOC_H_) |
23 | # define _MEMALLOC_H_ | |
726f6388 JA |
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 | ||
f73dda09 | 33 | #if defined (HAVE_ALLOCA_H) && !defined (HAVE_ALLOCA) && !defined (C_ALLOCA) |
726f6388 JA |
34 | # define HAVE_ALLOCA |
35 | #endif /* HAVE_ALLOCA_H && !HAVE_ALLOCA */ | |
36 | ||
b72432fd | 37 | #if defined (__GNUC__) && !defined (C_ALLOCA) |
726f6388 JA |
38 | # undef alloca |
39 | # define alloca __builtin_alloca | |
b72432fd JA |
40 | #else /* !__GNUC__ || C_ALLOCA */ |
41 | # if defined (HAVE_ALLOCA_H) && !defined (C_ALLOCA) | |
726f6388 JA |
42 | # if defined (IBMESA) |
43 | # include <malloc.h> | |
44 | # else /* !IBMESA */ | |
45 | # include <alloca.h> | |
46 | # endif /* !IBMESA */ | |
b72432fd | 47 | # else /* !HAVE_ALLOCA_H || C_ALLOCA */ |
d166f048 | 48 | # if defined (__hpux) && defined (__STDC__) && !defined (alloca) |
726f6388 JA |
49 | extern void *alloca (); |
50 | # else | |
ccc6cda3 | 51 | # if !defined (alloca) |
f73dda09 JA |
52 | # if defined (__STDC__) |
53 | extern void *alloca (size_t); | |
54 | # else | |
726f6388 | 55 | extern char *alloca (); |
f73dda09 | 56 | # endif /* !__STDC__ */ |
ccc6cda3 | 57 | # endif /* !alloca */ |
d166f048 | 58 | # endif /* !__hpux || !__STDC__ && !alloca */ |
b72432fd JA |
59 | # endif /* !HAVE_ALLOCA_H || C_ALLOCA */ |
60 | #endif /* !__GNUC__ || C_ALLOCA */ | |
726f6388 | 61 | |
ccc6cda3 | 62 | #endif /* _MEMALLOC_H_ */ |