GNU bug report logs - #6170
24.0.50; Compiling on solaris2.10 with gcc doesn't define alloca

Previous Next

Package: emacs;

Reported by: Lawrence Mitchell <wence <at> gmx.li>

Date: Tue, 11 May 2010 11:01:01 UTC

Severity: normal

Found in version 24.0.50

Done: Dan Nicolaescu <dann <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 6170 <at> debbugs.gnu.org (full text, mbox):

From: Dan Nicolaescu <dann <at> gnu.org>
To: Lawrence Mitchell <wence <at> gmx.li>
Cc: 6170 <at> debbugs.gnu.org
Subject: Re: bug#6170: 24.0.50;
	Compiling on solaris2.10 with gcc doesn't define alloca
Date: Wed, 12 May 2010 14:29:40 -0400
Lawrence Mitchell <wence <at> gmx.li> writes:

> On this system, <stdlib.h> is provided by Sun and therefore
> doesn't define alloca, unlike on a typical GNU/linux system where
> <stdlib.h> contains the following:
>
> | #if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC
> | # include <alloca.h>
> | #endif /* Use GNU, BSD, or misc.  */
>
> When compiling emacs with gcc, alloca is therefore undefined.
> The culprit is this snippet in configure.in:
>
> | #ifndef __GNUC__
> | # ifdef HAVE_ALLOCA_H
> | #  include <alloca.h>
> | # else /* AIX files deal with #pragma.  */
> | #  ifndef alloca /* predefined by HP cc +Olibcalls */
> | char *alloca ();
> | #  endif
> | # endif /* HAVE_ALLOCA_H */
> | #endif /* __GNUC__ */
>

"info autoconf" says that this is the proper way to do it:

          #ifdef HAVE_ALLOCA_H
          # include <alloca.h>
          #elif defined __GNUC__
          # define alloca __builtin_alloca
          #elif defined _AIX
          # define alloca __alloca
          #elif defined _MSC_VER
          # include <malloc.h>
          # define alloca _alloca
          #else
          # include <stddef.h>
          # ifdef  __cplusplus
          extern "C"
          # endif
          void *alloca (size_t);
          #endif

Not sure we need the last #else part, or the _MSC_VER part...




This bug report was last modified 14 years and 362 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.