summaryrefslogtreecommitdiff
path: root/Build/source/libs/gmp/m4/gmp-alloca.m4
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-18 11:12:01 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-18 11:12:01 +0000
commit0c2f0333a4e539325da80cdf3fb182cd17134665 (patch)
treede5daa66b5595292a33c25110aa58ff8bff75543 /Build/source/libs/gmp/m4/gmp-alloca.m4
parentdb612d5045ef55da386a2c3350d4811d1da1a858 (diff)
Add libs/gmp and libs/mpfr in preparation for MetaPost 2.0
git-svn-id: svn://tug.org/texlive/trunk@34274 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/gmp/m4/gmp-alloca.m4')
-rw-r--r--Build/source/libs/gmp/m4/gmp-alloca.m456
1 files changed, 56 insertions, 0 deletions
diff --git a/Build/source/libs/gmp/m4/gmp-alloca.m4 b/Build/source/libs/gmp/m4/gmp-alloca.m4
new file mode 100644
index 00000000000..2fc59023a88
--- /dev/null
+++ b/Build/source/libs/gmp/m4/gmp-alloca.m4
@@ -0,0 +1,56 @@
+# Autoconf macros for the GNU MP Library.
+# Copyright (C) 2000-2014 Free Software Foundation, Inc.
+#
+# Copyright (C) 2014 Peter Breitenlohner <tex-live@tug.org>
+# Extracted from gmp-6.0.0/acinclude.m4 and adapted for TeX Live.
+#
+# This file is free software; the copyright holders
+# give unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# GMP_FUNC_ALLOCA
+# ---------------
+# Determine whether "alloca" is available. This is AC_FUNC_ALLOCA from
+# autoconf, but changed so it doesn't use alloca.c if alloca() isn't
+# available, and also to use gmp-impl.h for the conditionals detecting
+# compiler builtin alloca's.
+
+AC_DEFUN([GMP_FUNC_ALLOCA], [dnl
+AC_REQUIRE([KPSE_GMP_H])
+_GMP_HEADER_ALLOCA
+AC_CACHE_CHECK([for alloca (via gmp-impl.h)],
+ [gmp_cv_func_alloca],
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "gmp-tmp.h"
+#include "$srcdir/gmp-]gmp_version[/gmp-impl.h"]],
+ [[char *p = (char *) alloca (1);]])],
+ [gmp_cv_func_alloca=yes],
+ [gmp_cv_func_alloca=no])])
+if test "x$gmp_cv_func_alloca" = xyes; then
+ AC_DEFINE([HAVE_ALLOCA], 1, [Define to 1 if alloca() works (via gmp-impl.h).])
+ AC_DEFINE([WANT_TMP_ALLOCA])
+else
+ AC_DEFINE([WANT_TMP_REENTRANT])
+fi
+AH_VERBATIM([WANT_TMP],
+[/* Define one of these to 1 for the temporary memory allocation method. */
+#undef WANT_TMP_ALLOCA
+#undef WANT_TMP_REENTRANT])
+]) # GMP_FUNC_ALLOCA
+
+# _GMP_HEADER_ALLOCA
+# ------------------
+# Internal subroutine
+m4_define([_GMP_HEADER_ALLOCA],
+[# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments. Useless!
+AC_CACHE_CHECK([for working alloca.h],
+ [gmp_cv_header_alloca],
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <alloca.h>]],
+ [[char *p = (char *) alloca (2 * sizeof (int));]])],
+ [gmp_cv_header_alloca=yes],
+ [gmp_cv_header_alloca=no])])
+if test "x$gmp_cv_header_alloca" = xyes; then
+ AC_DEFINE([HAVE_ALLOCA_H], 1,
+ [Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).])
+fi
+]) # _GMP_HEADER_ALLOCA