spot/m4/alloca.m4
Alexandre Duret-Lutz f8cdaf0c12 gnulib: Upgrade and build as a libtool library.
* lib/Makefile.am lib/alloca.in.h lib/argp-ba.c lib/argp-eexst.c
lib/argp-fmtstream.c lib/argp-fmtstream.h lib/argp-fs-xinl.c
lib/argp-help.c lib/argp-namefrob.h lib/argp-parse.c lib/argp-pin.c
lib/argp-pv.c lib/argp-pvh.c lib/argp-xinl.c lib/argp.h lib/asnprintf.c
lib/basename-lgpl.c lib/dirname-lgpl.c lib/dirname.h lib/dosname.h
lib/errno.in.h lib/error.c lib/error.h lib/fcntl.in.h lib/float+.h
lib/float.c lib/float.in.h lib/gethrxtime.c lib/gethrxtime.h
lib/getopt.c lib/getopt.in.h lib/getopt1.c lib/getopt_int.h
lib/gettext.h lib/gettime.c lib/gettimeofday.c lib/intprops.h
lib/itold.c lib/lstat.c lib/malloc.c lib/memchr.c lib/mempcpy.c
lib/mkstemp.c lib/msvc-inval.c lib/msvc-inval.h lib/msvc-nothrow.c
lib/msvc-nothrow.h lib/pathmax.h lib/printf-args.c lib/printf-args.h
lib/printf-parse.c lib/printf-parse.h lib/progname.c lib/progname.h
lib/rawmemchr.c lib/size_max.h lib/sleep.c lib/stat.c lib/stdalign.in.h
lib/stdbool.in.h lib/stddef.in.h lib/stdint.in.h lib/stdio.in.h
lib/stdlib.in.h lib/strcasecmp.c lib/strchrnul.c lib/strerror-override.c
lib/strerror-override.h lib/strerror.c lib/string.in.h lib/strings.in.h
lib/stripslash.c lib/strncasecmp.c lib/strndup.c lib/strnlen.c
lib/sys_stat.in.h lib/sys_time.in.h lib/sys_types.in.h lib/sys_wait.in.h
lib/sysexits.in.h lib/tempname.c lib/tempname.h lib/time.in.h
lib/timespec.h lib/unistd.in.h lib/vasnprintf.c lib/vasnprintf.h
lib/verify.h lib/vsnprintf.c lib/wchar.in.h lib/xsize.h lib/xtime.h
m4/00gnulib.m4 m4/alloca.m4 m4/argp.m4 m4/clock_time.m4 m4/dirname.m4
m4/double-slash-root.m4 m4/errno_h.m4 m4/error.m4 m4/exponentd.m4
m4/extensions.m4 m4/extern-inline.m4 m4/fcntl-o.m4 m4/fcntl_h.m4
m4/float_h.m4 m4/gethrxtime.m4 m4/getopt.m4 m4/gettime.m4
m4/gettimeofday.m4 m4/gnulib-cache.m4 m4/gnulib-common.m4
m4/gnulib-comp.m4 m4/gnulib-tool.m4 m4/include_next.m4 m4/intmax_t.m4
m4/inttypes_h.m4 m4/largefile.m4 m4/longlong.m4 m4/lstat.m4 m4/malloc.m4
m4/math_h.m4 m4/memchr.m4 m4/mempcpy.m4 m4/mkstemp.m4 m4/mmap-anon.m4
m4/msvc-inval.m4 m4/msvc-nothrow.m4 m4/multiarch.m4 m4/nocrash.m4
m4/off_t.m4 m4/pathmax.m4 m4/printf.m4 m4/rawmemchr.m4 m4/size_max.m4
m4/sleep.m4 m4/ssize_t.m4 m4/stat.m4 m4/stdalign.m4 m4/stdbool.m4
m4/stddef_h.m4 m4/stdint.m4 m4/stdint_h.m4 m4/stdio_h.m4 m4/stdlib_h.m4
m4/strcase.m4 m4/strchrnul.m4 m4/strerror.m4 m4/string_h.m4
m4/strings_h.m4 m4/strndup.m4 m4/strnlen.m4 m4/sys_socket_h.m4
m4/sys_stat_h.m4 m4/sys_time_h.m4 m4/sys_types_h.m4 m4/sys_wait_h.m4
m4/sysexits.m4 m4/tempname.m4 m4/time_h.m4 m4/timespec.m4 m4/unistd_h.m4
m4/vasnprintf.m4 m4/vsnprintf.m4 m4/warn-on-use.m4 m4/wchar_h.m4
m4/wchar_t.m4 m4/wint_t.m4 m4/xsize.m4 tools/snippet/arg-nonnull.h
tools/snippet/c++defs.h tools/snippet/warn-on-use.h: Upgrade to
gnulib 9ceceed274f83094127f9ff0bf061293c9fe1e7f.
* m4/secure_getenv.m4, lib/secure_getenv.c, lib/unistd.c,
lib/xtime.c: New files.
* src/bin/Makefile.am: Link with the libtool library.
2013-07-29 01:14:37 +02:00

121 lines
4.2 KiB
Text

# alloca.m4 serial 14
dnl Copyright (C) 2002-2004, 2006-2007, 2009-2013 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_ALLOCA],
[
AC_REQUIRE([AC_FUNC_ALLOCA])
if test $ac_cv_func_alloca_works = no; then
gl_PREREQ_ALLOCA
fi
# Define an additional variable used in the Makefile substitution.
if test $ac_cv_working_alloca_h = yes; then
AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [
AC_EGREP_CPP([Need own alloca], [
#if defined __GNUC__ || defined _AIX || defined _MSC_VER
Need own alloca
#endif
], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no])
])
if test $gl_cv_rpl_alloca = yes; then
dnl OK, alloca can be implemented through a compiler built-in.
AC_DEFINE([HAVE_ALLOCA], [1],
[Define to 1 if you have 'alloca' after including <alloca.h>,
a header that may be supplied by this distribution.])
ALLOCA_H=alloca.h
else
dnl alloca exists as a library function, i.e. it is slow and probably
dnl a memory leak. Don't define HAVE_ALLOCA in this case.
ALLOCA_H=
fi
else
ALLOCA_H=alloca.h
fi
AC_SUBST([ALLOCA_H])
AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"])
])
# Prerequisites of lib/alloca.c.
# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
AC_DEFUN([gl_PREREQ_ALLOCA], [:])
# This works around a bug in autoconf <= 2.68.
# See <http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00277.html>.
m4_version_prereq([2.69], [] ,[
# This is taken from the following Autoconf patch:
# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497
# _AC_LIBOBJ_ALLOCA
# -----------------
# Set up the LIBOBJ replacement of 'alloca'. Well, not exactly
# AC_LIBOBJ since we actually set the output variable 'ALLOCA'.
# Nevertheless, for Automake, AC_LIBSOURCES it.
m4_define([_AC_LIBOBJ_ALLOCA],
[# The SVR3 libPW and SVR4 libucb both contain incompatible functions
# that cause trouble. Some versions do not even contain alloca or
# contain a buggy version. If you still want to use their alloca,
# use ar to extract alloca.o from them instead of compiling alloca.c.
AC_LIBSOURCES(alloca.c)
AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl
AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using 'alloca.c'.])
AC_CACHE_CHECK(whether 'alloca.c' needs Cray hooks, ac_cv_os_cray,
[AC_EGREP_CPP(webecray,
[#if defined CRAY && ! defined CRAY2
webecray
#else
wenotbecray
#endif
], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
AC_CHECK_FUNC($ac_func,
[AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
[Define to one of '_getb67', 'GETB67',
'getb67' for Cray-2 and Cray-YMP
systems. This function is required for
'alloca.c' support on those systems.])
break])
done
fi
AC_CACHE_CHECK([stack direction for C alloca],
[ac_cv_c_stack_direction],
[AC_RUN_IFELSE([AC_LANG_SOURCE(
[AC_INCLUDES_DEFAULT
int
find_stack_direction (int *addr, int depth)
{
int dir, dummy = 0;
if (! addr)
addr = &dummy;
*addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
dir = depth ? find_stack_direction (addr, depth - 1) : 0;
return dir + dummy;
}
int
main (int argc, char **argv)
{
return find_stack_direction (0, argc + !argv + 20) < 0;
}])],
[ac_cv_c_stack_direction=1],
[ac_cv_c_stack_direction=-1],
[ac_cv_c_stack_direction=0])])
AH_VERBATIM([STACK_DIRECTION],
[/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
@%:@undef STACK_DIRECTION])dnl
AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
])# _AC_LIBOBJ_ALLOCA
])