summaryrefslogtreecommitdiffstats
path: root/gl/m4/alloca.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/alloca.m4')
-rw-r--r--gl/m4/alloca.m453
1 files changed, 19 insertions, 34 deletions
diff --git a/gl/m4/alloca.m4 b/gl/m4/alloca.m4
index 270abd0..dc6f47e 100644
--- a/gl/m4/alloca.m4
+++ b/gl/m4/alloca.m4
@@ -1,5 +1,5 @@
1# alloca.m4 serial 14 1# alloca.m4 serial 21
2dnl Copyright (C) 2002-2004, 2006-2007, 2009-2013 Free Software Foundation, 2dnl Copyright (C) 2002-2004, 2006-2007, 2009-2022 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -26,30 +26,35 @@ AC_DEFUN([gl_FUNC_ALLOCA],
26 AC_DEFINE([HAVE_ALLOCA], [1], 26 AC_DEFINE([HAVE_ALLOCA], [1],
27 [Define to 1 if you have 'alloca' after including <alloca.h>, 27 [Define to 1 if you have 'alloca' after including <alloca.h>,
28 a header that may be supplied by this distribution.]) 28 a header that may be supplied by this distribution.])
29 ALLOCA_H=alloca.h 29 GL_GENERATE_ALLOCA_H=true
30 else 30 else
31 dnl alloca exists as a library function, i.e. it is slow and probably 31 dnl alloca exists as a library function, i.e. it is slow and probably
32 dnl a memory leak. Don't define HAVE_ALLOCA in this case. 32 dnl a memory leak. Don't define HAVE_ALLOCA in this case.
33 ALLOCA_H= 33 GL_GENERATE_ALLOCA_H=false
34 fi 34 fi
35 else 35 else
36 ALLOCA_H=alloca.h 36 GL_GENERATE_ALLOCA_H=true
37 fi 37 fi
38 AC_SUBST([ALLOCA_H]) 38
39 AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"]) 39 if test $ac_cv_working_alloca_h = yes; then
40 HAVE_ALLOCA_H=1
41 else
42 HAVE_ALLOCA_H=0
43 fi
44 AC_SUBST([HAVE_ALLOCA_H])
40]) 45])
41 46
42# Prerequisites of lib/alloca.c. 47# Prerequisites of lib/alloca.c.
43# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA. 48# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
44AC_DEFUN([gl_PREREQ_ALLOCA], [:]) 49AC_DEFUN([gl_PREREQ_ALLOCA], [:])
45 50
46# This works around a bug in autoconf <= 2.68. 51m4_version_prereq([2.70], [], [
47# See <http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00277.html>.
48 52
49m4_version_prereq([2.69], [] ,[ 53# This works around a bug in autoconf <= 2.68 and has simplifications
50 54# from 2.70. See:
51# This is taken from the following Autoconf patch: 55# https://lists.gnu.org/r/bug-gnulib/2011-06/msg00277.html
52# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497 56# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497
57# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=15edf7fd8094fd14a89d9891dd72a9624762597a
53 58
54# _AC_LIBOBJ_ALLOCA 59# _AC_LIBOBJ_ALLOCA
55# ----------------- 60# -----------------
@@ -65,26 +70,6 @@ AC_LIBSOURCES(alloca.c)
65AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl 70AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl
66AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using 'alloca.c'.]) 71AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using 'alloca.c'.])
67 72
68AC_CACHE_CHECK(whether 'alloca.c' needs Cray hooks, ac_cv_os_cray,
69[AC_EGREP_CPP(webecray,
70[#if defined CRAY && ! defined CRAY2
71webecray
72#else
73wenotbecray
74#endif
75], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
76if test $ac_cv_os_cray = yes; then
77 for ac_func in _getb67 GETB67 getb67; do
78 AC_CHECK_FUNC($ac_func,
79 [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
80 [Define to one of '_getb67', 'GETB67',
81 'getb67' for Cray-2 and Cray-YMP
82 systems. This function is required for
83 'alloca.c' support on those systems.])
84 break])
85 done
86fi
87
88AC_CACHE_CHECK([stack direction for C alloca], 73AC_CACHE_CHECK([stack direction for C alloca],
89 [ac_cv_c_stack_direction], 74 [ac_cv_c_stack_direction],
90[AC_RUN_IFELSE([AC_LANG_SOURCE( 75[AC_RUN_IFELSE([AC_LANG_SOURCE(
@@ -115,7 +100,7 @@ AH_VERBATIM([STACK_DIRECTION],
115 STACK_DIRECTION > 0 => grows toward higher addresses 100 STACK_DIRECTION > 0 => grows toward higher addresses
116 STACK_DIRECTION < 0 => grows toward lower addresses 101 STACK_DIRECTION < 0 => grows toward lower addresses
117 STACK_DIRECTION = 0 => direction of growth unknown */ 102 STACK_DIRECTION = 0 => direction of growth unknown */
118@%:@undef STACK_DIRECTION])dnl 103#undef STACK_DIRECTION])dnl
119AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) 104AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
120])# _AC_LIBOBJ_ALLOCA 105])# _AC_LIBOBJ_ALLOCA
121]) 106])