diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-12-20 21:21:04 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-12-20 21:22:34 -0800 |
commit | fd29dbd7d966f0fbde031a67955d77d50268c3d5 (patch) | |
tree | 2bb01e6d71d7cca7ea33409e4a82d0367f383870 /lib/autoconf/functions.m4 | |
parent | eeb7e7d58ed7e1fc0eaae53a61e910bd1272f5d2 (diff) | |
download | autoconf-fd29dbd7d966f0fbde031a67955d77d50268c3d5.tar.gz |
AC_FUNC_ALLOCA: port to recent BSDs and remove obsolete AIX
* doc/autoconf.texi (Particular Functions): Remove the AIX case
from the recommended code, as the most recent version of the AIX
compiler that IBM still supports (V10.1 as of this writing) has
<alloca.h> and thus longer needs this, and the old suggestion
wasn't completely working anyway. Remove obsolete discussion of
SVR3 libPW alloca and of SVR4 libucb alloca.
* lib/autoconf/functions.m4 (AC_FUNC_ALLOCA):
Rework to match documentation, including abovementioned AIX change.
Inconsistency with documentation reported by Steven G. Johnson in
<http://lists.gnu.org/archive/html/autoconf/2003-03/msg00179.html>.
As this adds stdlib.h, it should also fix the problems on recent
BSD platforms noted by Patrick Welche in
http://lists.gnu.org/archive/html/autoconf-patches/2012-12/msg00009.html
though the fix differs from NetBSD's current workaround.
Also, don't bother checking for alloca if <alloca.h> works,
as the latter implies the former.
Diffstat (limited to 'lib/autoconf/functions.m4')
-rw-r--r-- | lib/autoconf/functions.m4 | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index de7a6b86..db7be052 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -372,36 +372,36 @@ AC_CACHE_CHECK([for working alloca.h], ac_cv_working_alloca_h, [ac_cv_working_alloca_h=no])]) if test $ac_cv_working_alloca_h = yes; then AC_DEFINE(HAVE_ALLOCA_H, 1, - [Define to 1 if you have <alloca.h> and it should be used - (not on Ultrix).]) + [Define to 1 if <alloca.h> works.]) fi AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works, -[AC_LINK_IFELSE([AC_LANG_PROGRAM( -[[#ifdef __GNUC__ -# define alloca __builtin_alloca -#else -# ifdef _MSC_VER +[if test $ac_cv_working_alloca_h = yes; then + ac_cv_func_alloca_works=yes +else + AC_LINK_IFELSE([AC_LANG_PROGRAM( +[[#if defined STDC_HEADERS || defined HAVE_STDLIB_H +# include <stdlib.h> +#endif +#include <stddef.h> +#ifndef alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _MSC_VER # include <malloc.h> # define alloca _alloca # else -# ifdef HAVE_ALLOCA_H -# include <alloca.h> -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -void *alloca (size_t); -# endif -# endif +# ifdef __cplusplus +extern "C" # endif +void *alloca (size_t); # endif #endif ]], [[char *p = (char *) alloca (1); if (p) return 0;]])], [ac_cv_func_alloca_works=yes], [ac_cv_func_alloca_works=no])]) +fi if test $ac_cv_func_alloca_works = yes; then AC_DEFINE(HAVE_ALLOCA, 1, |