2N/A# alloca.m4 serial 9
2N/Adnl Copyright (C) 2002-2004, 2006-2007, 2009-2010 Free Software Foundation,
2N/Adnl Inc.
2N/Adnl This file is free software; the Free Software Foundation
2N/Adnl gives unlimited permission to copy and/or distribute it,
2N/Adnl with or without modifications, as long as this notice is preserved.
2N/A
2N/AAC_DEFUN([gl_FUNC_ALLOCA],
2N/A[
2N/A dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
2N/A AC_REQUIRE([AC_PROG_CPP])
2N/A AC_REQUIRE([AC_PROG_EGREP])
2N/A
2N/A AC_REQUIRE([AC_FUNC_ALLOCA])
2N/A if test $ac_cv_func_alloca_works = no; then
2N/A gl_PREREQ_ALLOCA
2N/A fi
2N/A
2N/A # Define an additional variable used in the Makefile substitution.
2N/A if test $ac_cv_working_alloca_h = yes; then
2N/A AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [
2N/A AC_EGREP_CPP([Need own alloca], [
2N/A#if defined __GNUC__ || defined _AIX || defined _MSC_VER
2N/A Need own alloca
2N/A#endif
2N/A ], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no])
2N/A ])
2N/A if test $gl_cv_rpl_alloca = yes; then
2N/A dnl OK, alloca can be implemented through a compiler built-in.
2N/A AC_DEFINE([HAVE_ALLOCA], [1],
2N/A [Define to 1 if you have 'alloca' after including <alloca.h>,
2N/A a header that may be supplied by this distribution.])
2N/A ALLOCA_H=alloca.h
2N/A else
2N/A dnl alloca exists as a library function, i.e. it is slow and probably
2N/A dnl a memory leak. Don't define HAVE_ALLOCA in this case.
2N/A ALLOCA_H=
2N/A fi
2N/A else
2N/A ALLOCA_H=alloca.h
2N/A fi
2N/A AC_SUBST([ALLOCA_H])
2N/A])
2N/A
2N/A# Prerequisites of lib/alloca.c.
2N/A# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
2N/AAC_DEFUN([gl_PREREQ_ALLOCA], [:])