summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux')
-rw-r--r--build-aux/m4/debug.m494
-rw-r--r--build-aux/m4/gmp.m477
-rw-r--r--build-aux/m4/gnulib-cache.m4120
-rw-r--r--build-aux/m4/m4-error.m441
-rw-r--r--build-aux/m4/m4-getopt.m435
-rw-r--r--build-aux/m4/m4-gettext.m435
-rw-r--r--build-aux/m4/m4-obstack.m450
-rw-r--r--build-aux/m4/m4-regex.m439
-rw-r--r--build-aux/m4/m4-rename.m445
-rw-r--r--build-aux/m4/m4-syscmd.m459
-rw-r--r--build-aux/m4/stackovf.m491
11 files changed, 686 insertions, 0 deletions
diff --git a/build-aux/m4/debug.m4 b/build-aux/m4/debug.m4
new file mode 100644
index 00000000..2bb5739d
--- /dev/null
+++ b/build-aux/m4/debug.m4
@@ -0,0 +1,94 @@
+## -*- Autoconf -*-
+## debug.m4 -- massage compiler flags for debugging/optimisation
+##
+## Copyright (C) 2000-2001, 2003, 2005-2007, 2010, 2013 Free Software
+## Foundation, Inc.
+## Copyright (C) 1999-2000 Ralf S. Engelschall
+## Written by <rse@engelschall.com>
+## Modified for M4 by Gary V. Vaughan <gary@gnu.org>
+##
+## This file is part of GNU M4.
+##
+## GNU M4 is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## GNU M4 is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# serial 9
+
+# M4_CHECK_DEBUGGING
+# ------------------
+# Debugging Support
+AC_DEFUN([M4_CHECK_DEBUGGING],
+[AC_REQUIRE([AC_PROG_CC])
+AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug],
+ [build for debugging [default=no]])])
+AC_MSG_CHECKING([for compilation debug mode])
+AC_MSG_RESULT([${enable_debug-no}])
+
+: ${rm=rm -f}
+: ${RM=rm -f}
+
+set dummy $CC
+compiler="${compiler-[$]2}"
+test -n "$rm" || rm="rm -f"
+
+if test "X$enable_debug" = Xyes; then
+ AC_DISABLE_SHARED
+ AC_DEFINE([DEBUG], [1],
+ [Define this to enable additional runtime debugging])
+ M4_default_preload="m4 traditional gnu load \
+import modtest mpeval shadow stdlib time"
+ if test "$GCC" = yes; then
+ case "$CFLAGS" in
+ *-O* ) CFLAGS=`echo $CFLAGS | $SED 's/-O[[^ ]]* / /;s/-O[[^ ]]*$//'` ;;
+ esac
+ case "$CFLAGS" in
+ *-g* ) ;;
+ * ) AC_LIBTOOL_COMPILER_OPTION([if $compiler accepts -ggdb3],
+ [M4_cv_prog_compiler_ggdb3],
+ [-ggdb3 -c conftest.$ac_ext], [],
+ [CFLAGS="$CFLAGS -ggdb3"],
+ [CFLAGS="$CFLAGS -g"])
+ ;;
+ esac
+ CFLAGS="$CFLAGS -Wall"
+ WMORE="-Wshadow -Wpointer-arith -Wcast-align -Wnested-externs"
+ WMORE="$WMORE -Wmissing-prototypes -Wmissing-declarations -Winline"
+ AC_LIBTOOL_COMPILER_OPTION([if $compiler accepts $WMORE],
+ [M4_cv_prog_compiler_warning_flags],
+ [$WMORE -c conftest.$ac_ext], [],
+ [CFLAGS="$CFLAGS $WMORE"])
+
+ AC_LIBTOOL_COMPILER_OPTION([if $compiler accepts -Wno-long-long],
+ [M4_cv_prog_compiler_wnolonglong],
+ [-Wno-long-long -c conftest.$ac_ext], [],
+ [CFLAGS="$CFLAGS -Wno-long-long"])
+ else
+ case "$CFLAGS" in
+ *-g* ) ;;
+ * ) CFLAGS="$CFLAGS -g" ;;
+ esac
+ fi
+else
+ AC_ENABLE_SHARED
+ case "$CFLAGS" in
+ *-g* ) CFLAGS=`echo "$CFLAGS" |\
+ $SED -e 's/ -g / /g;s/ -g$//;s/^-g //g;s/^-g$//'`
+ ;;
+ esac
+ case "$CXXFLAGS" in
+ *-g* ) CXXFLAGS=`echo "$CXXFLAGS" |\
+ $SED -e 's/ -g / /g;s/ -g$//;s/^-g //g;s/^-g$//'`
+ ;;
+ esac
+fi
+])# M4_CHECK_DEBUGGING
diff --git a/build-aux/m4/gmp.m4 b/build-aux/m4/gmp.m4
new file mode 100644
index 00000000..36e60516
--- /dev/null
+++ b/build-aux/m4/gmp.m4
@@ -0,0 +1,77 @@
+## -*- Autoconf -*-
+## Copyright (C) 2000-2001, 2003, 2006-2008, 2010, 2013 Free Software
+## Foundation, Inc.
+##
+## This file is part of GNU M4.
+##
+## GNU M4 is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## GNU M4 is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# serial 10
+
+m4_define([_M4_LIB_GMP],
+[AC_ARG_WITH([gmp],
+ [AS_HELP_STRING([--without-gmp],
+ [don't use GNU multiple precision arithmetic library])],
+[use_gmp=$withval], [use_gmp=yes])
+
+case $use_gmp:$LIBADD_GMP:$ac_cv_header_gmp_h in
+ no:*)
+ M4_cv_using_lib_gmp=no
+ ;;
+ *::yes)
+ AC_MSG_WARN([gmp library not found or does not appear to work
+ but `gmp.h' is present])
+ M4_cv_using_lib_gmp=no
+ ;;
+ *:-lgmp:no)
+ AC_MSG_WARN([gmp works but `gmp.h' is missing])
+ M4_cv_using_lib_gmp=no
+ ;;
+ yes:*:yes)
+ M4_cv_using_lib_gmp=yes
+ ;;
+ *)
+ M4_cv_using_lib_gmp=no
+ AC_MSG_WARN([could not detect gmp library])
+ ;;
+esac
+])# _M4_LIB_GMP
+
+
+AC_DEFUN([M4_LIB_GMP],
+[AC_PREREQ([2.56])dnl We use the new compiler based header checking in 2.56
+AC_CHECK_HEADERS([gmp.h], [], [], [AC_INCLUDES_DEFAULT])
+m4_pattern_allow([^M4_gmp_save_LIBS$])
+# Some versions of gmp provide mpq_init as a macro, so we need to
+# include the header file, otherwise the detection will fail.
+M4_gmp_save_LIBS="$LIBS"
+LIBS="$LIBS -lgmp"
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_GMP_H
+# include <gmp.h>
+#endif]],
+ [[mpq_t n; mpq_init (n);]])],
+ [LIBADD_GMP=-lgmp])
+LIBS=$M4_gmp_save_LIBS
+AC_SUBST([LIBADD_GMP])
+
+_M4_LIB_GMP
+
+# Don't try to link in libgmp if we are not using it after the last call
+if test "$M4_cv_using_lib_gmp" = yes; then
+ AC_DEFINE([USE_GMP], [1],
+ [Define to 1 if using the GNU multiple precision library.])
+fi
+
+AC_SUBST([USE_GMP], [$M4_cv_using_lib_gmp])
+])# M4_LIB_GMP
diff --git a/build-aux/m4/gnulib-cache.m4 b/build-aux/m4/gnulib-cache.m4
new file mode 100644
index 00000000..6ac73fb1
--- /dev/null
+++ b/build-aux/m4/gnulib-cache.m4
@@ -0,0 +1,120 @@
+# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this file. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License,
+# this file may be distributed as part of a program that
+# contains a configuration script generated by Autoconf, under
+# the same distribution terms as the rest of that program.
+#
+# Generated by gnulib-tool.
+#
+# This file represents the specification of how gnulib-tool is used.
+# It acts as a cache: It is written and read by gnulib-tool.
+# In projects that use version control, this file is meant to be put under
+# version control, like the configure.ac and various Makefile.am files.
+
+
+# Specification in the form of a command-line invocation:
+# gnulib-tool --import --dir=. --local-dir=build-aux/gl --lib=libgnu --source-base=gnu --m4-base=build-aux/m4 --doc-base=doc --tests-base=tests/gnu --aux-dir=build-aux --with-tests --with-c++-tests --no-conditional-dependencies --libtool --macro-prefix=M4 assert autobuild avltree-oset binary-io bitrotate clean-temp cloexec close-stream closein config-h configmake dirname error execute fclose fdl-1.3 fflush filenamecat flexmember fopen fopen-safer freadptr freadseek fseeko gendocs gettext git-version-gen gitlog-to-changelog gnumakefile gnupload gpl-3.0 intprops inttypes maintainer-makefile manywarnings memchr2 memcmp2 memmem mkstemp obstack obstack-printf-posix progname propername quote regex regexprops-generic rename setenv sigpipe snprintf-posix spawn-pipe sprintf-posix stdbool stdlib-safer strnlen strtod tempname unlocked-io unsetenv update-copyright vasnprintf-posix verify verror wait-process xalloc xalloc-die xmemdup0 xoset xprintf-posix xstrndup xvasprintf-posix
+
+# Specification in the form of a few gnulib-tool.m4 macro invocations:
+gl_LOCAL_DIR([build-aux/gl])
+gl_MODULES([
+ assert
+ autobuild
+ avltree-oset
+ binary-io
+ bitrotate
+ clean-temp
+ cloexec
+ close-stream
+ closein
+ config-h
+ configmake
+ dirname
+ error
+ execute
+ fclose
+ fdl-1.3
+ fflush
+ filenamecat
+ flexmember
+ fopen
+ fopen-safer
+ freadptr
+ freadseek
+ fseeko
+ gendocs
+ gettext
+ git-version-gen
+ gitlog-to-changelog
+ gnumakefile
+ gnupload
+ gpl-3.0
+ intprops
+ inttypes
+ maintainer-makefile
+ manywarnings
+ memchr2
+ memcmp2
+ memmem
+ mkstemp
+ obstack
+ obstack-printf-posix
+ progname
+ propername
+ quote
+ regex
+ regexprops-generic
+ rename
+ setenv
+ sigpipe
+ snprintf-posix
+ spawn-pipe
+ sprintf-posix
+ stdbool
+ stdlib-safer
+ strnlen
+ strtod
+ tempname
+ unlocked-io
+ unsetenv
+ update-copyright
+ vasnprintf-posix
+ verify
+ verror
+ wait-process
+ xalloc
+ xalloc-die
+ xmemdup0
+ xoset
+ xprintf-posix
+ xstrndup
+ xvasprintf-posix
+])
+gl_WITH_CXX_TESTS
+gl_AVOID([])
+gl_SOURCE_BASE([gnu])
+gl_M4_BASE([build-aux/m4])
+gl_PO_BASE([])
+gl_DOC_BASE([doc])
+gl_TESTS_BASE([tests/gnu])
+gl_WITH_TESTS
+gl_LIB([libgnu])
+gl_MAKEFILE_NAME([])
+gl_LIBTOOL
+gl_MACRO_PREFIX([M4])
+gl_PO_DOMAIN([])
+gl_WITNESS_C_MACRO([])
diff --git a/build-aux/m4/m4-error.m4 b/build-aux/m4/m4-error.m4
new file mode 100644
index 00000000..27695cbb
--- /dev/null
+++ b/build-aux/m4/m4-error.m4
@@ -0,0 +1,41 @@
+# -*- Autoconf -*-
+# m4-error.m4 -- Use the installed version of error.h if available.
+# Written by Gary V. Vaughan <gary@gnu.org>
+#
+# Copyright (C) 2003-2004, 2006-2007, 2010, 2013 Free Software
+# Foundation, Inc.
+#
+# This file is part of GNU M4.
+#
+# GNU M4 is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU M4 is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# serial 4
+
+# M4_ERROR
+# --------
+# Use the installed version of error.h if available.
+AC_DEFUN([M4_ERROR],
+[AC_BEFORE([gl_ERROR], [M4_ERROR])
+
+AC_CHECK_HEADERS([error.h],
+ [ERROR_H=""], [ERROR_H="error.h"], [AC_INCLUDES_DEFAULT])
+AC_SUBST([ERROR_H])
+
+if test $ac_cv_header_error_h = yes; then
+ INCLUDE_ERROR_H='#include <error.h>'
+else
+ INCLUDE_ERROR_H='#include <gnu/error.h>'
+fi
+AC_SUBST([INCLUDE_ERROR_H])
+])# M4_ERROR
diff --git a/build-aux/m4/m4-getopt.m4 b/build-aux/m4/m4-getopt.m4
new file mode 100644
index 00000000..a2d3a4e3
--- /dev/null
+++ b/build-aux/m4/m4-getopt.m4
@@ -0,0 +1,35 @@
+# -*- Autoconf -*-
+# m4-getopt.m4 -- Use the installed version of getopt.h if available.
+# Written by Gary V. Vaughan <gary@gnu.org>
+#
+# Copyright (C) 2005-2007, 2009-2010, 2013 Free Software Foundation,
+# Inc.
+#
+# This file is part of GNU M4.
+#
+# GNU M4 is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU M4 is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# serial 3
+
+# M4_GETOPT
+# ---------
+# Use the installed version of getopt.h if available.
+AC_DEFUN([M4_GETOPT],
+[
+ m4_divert_text([INIT_PREPARE], [M4_replace_getopt=])
+ m4_pushdef([AC_LIBOBJ], [M4_replace_getopt=:])
+ AC_REQUIRE([gl_FUNC_GETOPT_GNU])
+ m4_popdef([AC_LIBOBJ])
+ AM_CONDITIONAL([GETOPT], [test -n "$M4_replace_getopt"])
+])# M4_GETOPT
diff --git a/build-aux/m4/m4-gettext.m4 b/build-aux/m4/m4-gettext.m4
new file mode 100644
index 00000000..3c40d730
--- /dev/null
+++ b/build-aux/m4/m4-gettext.m4
@@ -0,0 +1,35 @@
+# -*- Autoconf -*-
+# m4-gettext.m4 -- Use the installed version of GNU gettext if available.
+# Written by Gary V. Vaughan <gary@gnu.org>
+#
+# Copyright (C) 2003-2004, 2006-2007, 2010, 2013 Free Software
+# Foundation, Inc.
+#
+# This file is part of GNU M4.
+#
+# GNU M4 is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU M4 is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# serial 3
+
+# M4_GNU_GETTEXT
+# --------------
+# Use the installed version of GNU gettext if available.
+AC_DEFUN([M4_GNU_GETTEXT],
+[AC_BEFORE([AM_GNU_GETTEXT], [M4_GNU_GETTEXT])
+AC_CHECK_HEADERS([gettext.h],
+ [GETTEXT_H=""], [GETTEXT_H="gettext.h"], [AC_INCLUDES_DEFAULT])
+AC_SUBST([GETTEXT_H])
+
+AC_CONFIG_FILES([po/Makefile.in])
+])# M4_GNU_GETTEXT
diff --git a/build-aux/m4/m4-obstack.m4 b/build-aux/m4/m4-obstack.m4
new file mode 100644
index 00000000..fab387ba
--- /dev/null
+++ b/build-aux/m4/m4-obstack.m4
@@ -0,0 +1,50 @@
+# -*- Autoconf -*-
+# m4-obstack.m4 -- the libc supplied version of obstacks if available.
+#
+# Copyright (C) 2000-2001, 2003-2004, 2006-2007, 2010, 2013 Free
+# Software Foundation, Inc.
+# Written by Gary V. Vaughan <gary@gnu.org>
+#
+# This file is part of GNU M4.
+#
+# GNU M4 is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU M4 is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# serial 10
+
+# M4_OBSTACK
+# ----------
+# Use the libc supplied version of obstacks if available.
+AC_DEFUN([M4_OBSTACK],
+[AC_PREREQ([2.56])dnl We use the compiler based header checking in 2.56
+AC_BEFORE([gl_OBSTACK], [M4_OBSTACK])
+AC_ARG_WITH([included-obstack],
+ [AS_HELP_STRING([--with-included-obstack],
+ [use the obstack implementation included here])])
+
+AC_CHECK_HEADERS([obstack.h], [], [], [AC_INCLUDES_DEFAULT])
+
+if test "x${with_included_obstack-no}" != xno; then
+ ac_cv_func_obstack=no
+fi
+
+OBSTACK_H=
+if test $ac_cv_func_obstack = yes; then
+ INCLUDE_OBSTACK_H='#include <obstack.h>'
+else
+ INCLUDE_OBSTACK_H='#include <gnu/obstack.h>'
+ OBSTACK_H=obstack.h
+fi
+AC_SUBST([OBSTACK_H])
+AC_SUBST([INCLUDE_OBSTACK_H])
+])# M4_FUNC_OBSTACK
diff --git a/build-aux/m4/m4-regex.m4 b/build-aux/m4/m4-regex.m4
new file mode 100644
index 00000000..e7fa38af
--- /dev/null
+++ b/build-aux/m4/m4-regex.m4
@@ -0,0 +1,39 @@
+# -*- Autoconf -*-
+# m4-regex.m4 -- Use the installed regex if it is good enough.
+# Written by Gary V. Vaughan <gary@gnu.org>
+#
+# Copyright (C) 2003-2004, 2006-2007, 2010, 2013 Free Software
+# Foundation, Inc.
+#
+# This file is part of GNU M4.
+#
+# GNU M4 is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU M4 is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# serial 4
+
+# M4_REGEX([path/to/regex.c])
+# ---------------------------
+# Use the installed regex if it is good enough.
+AC_DEFUN([M4_REGEX],
+[AC_BEFORE([gl_REGEX], [M4_REGEX])
+if test $ac_use_included_regex = no; then
+ INCLUDE_REGEX_H='#include <regex.h>'
+ REGEX_H=
+else
+ INCLUDE_REGEX_H='#include <gnu/regex.h>'
+ REGEX_H=regex.h
+fi
+AC_SUBST([REGEX_H])
+AC_SUBST([INCLUDE_REGEX_H])
+])# M4_REGEX
diff --git a/build-aux/m4/m4-rename.m4 b/build-aux/m4/m4-rename.m4
new file mode 100644
index 00000000..4062cdec
--- /dev/null
+++ b/build-aux/m4/m4-rename.m4
@@ -0,0 +1,45 @@
+# -*- Autoconf -*-
+# m4-rename.m4 -- Test the abilities of rename.
+# Written by Eric Blake <ebb9@byu.net>
+#
+# Copyright (C) 2008, 2010, 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU M4.
+#
+# GNU M4 is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU M4 is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# serial 1
+
+# M4_RENAME
+# ---------
+# Detect platforms like mingw where rename can't move open files.
+AC_DEFUN([M4_RENAME],
+[AC_CACHE_CHECK([whether an open file can be renamed],
+ [M4_cv_func_rename_open_file_works],
+ [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
+ [FILE *f = fopen ("conftest.1", "w+");
+ int result = rename ("conftest.1", "conftest.2");
+ fclose (f); remove ("conftest.1"); remove ("conftest.2");
+ return result;])],
+ [M4_cv_func_rename_open_file_works=yes],
+ [M4_cv_func_rename_open_file_works=no],
+ [M4_cv_func_rename_open_file_works='guessing no'])])
+if test "$M4_cv_func_rename_open_file_works" = yes ; then
+ M4_rename_open_works=1
+else
+ M4_rename_open_works=0
+fi
+AC_DEFINE_UNQUOTED([RENAME_OPEN_FILE_WORKS], [$M4_rename_open_works],
+ [Define to 1 if a file can be renamed while open, or to 0 if not.])
+])
diff --git a/build-aux/m4/m4-syscmd.m4 b/build-aux/m4/m4-syscmd.m4
new file mode 100644
index 00000000..514201fa
--- /dev/null
+++ b/build-aux/m4/m4-syscmd.m4
@@ -0,0 +1,59 @@
+# -*- Autoconf -*-
+# m4-syscmd.m4 -- Allow choice of syscmd shell.
+# Written by Eric Blake <ebb9@byu.net>
+#
+# Copyright (C) 2009-2010, 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU M4.
+#
+# GNU M4 is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU M4 is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# serial 1
+
+# M4_SYSCMD
+# ---------
+# Allow user to choose different shell than /bin/sh for e?syscmd.
+AC_DEFUN([M4_SYSCMD],
+[AC_MSG_CHECKING([[which shell to use for syscmd]])
+AC_ARG_WITH([syscmd-shell],
+ [AS_HELP_STRING([--with-syscmd-shell], [shell used by syscmd [/bin/sh]])],
+ [case $withval in
+ yes[)] with_syscmd_shell=no;;
+ esac], [with_syscmd_shell=no])
+if test "$with_syscmd_shell" = no ; then
+ with_syscmd_shell=/bin/sh
+ if test "$cross_compiling" != yes ; then
+dnl Give mingw a default that is more likely to be available.
+ AS_IF([AS_EXECUTABLE_P([/bin/sh])], [],
+ [if (cmd /c) 2>/dev/null; then with_syscmd_shell=cmd; fi])
+dnl Too bad _AS_PATH_WALK is not public.
+ M4_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ for M4_dir in `if (command -p getconf PATH) 2>/dev/null ; then
+ command -p getconf PATH
+ else
+ echo "/bin$PATH_SEPARATOR$PATH"
+ fi`
+ do
+ IFS=$M4_save_IFS
+ test -z "$M4_dir" && continue
+ AS_EXECUTABLE_P(["$M4_dir/sh"]) \
+ && { with_syscmd_shell=$M4_dir/sh; break; }
+ done
+ IFS=$M4_save_IFS
+ fi
+fi
+AC_MSG_RESULT([$with_syscmd_shell])
+AC_DEFINE_UNQUOTED([M4_SYSCMD_SHELL], ["$with_syscmd_shell"],
+ [Shell used by syscmd and esyscmd, must accept -c argument.])
+])
diff --git a/build-aux/m4/stackovf.m4 b/build-aux/m4/stackovf.m4
new file mode 100644
index 00000000..d1812230
--- /dev/null
+++ b/build-aux/m4/stackovf.m4
@@ -0,0 +1,91 @@
+# -*- Autoconf -*-
+# stackovf.m4 -- how do we deal with stack overflow?
+#
+# Copyright (C) 2000, 2003, 2006-2007, 2010, 2013 Free Software
+# Foundation, Inc.
+#
+# This file is part of GNU M4.
+#
+# GNU M4 is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU M4 is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# serial 7
+
+# M4_SYS_STACKOVF
+# ---------------
+AC_DEFUN([M4_SYS_STACKOVF],
+[AC_PREREQ([2.60])dnl We use the _ONCE variants
+AC_REQUIRE([AC_TYPE_SIGNAL])dnl
+
+AC_CHECK_HEADERS_ONCE([siginfo.h])
+AC_CHECK_FUNCS_ONCE([sigaction sigaltstack sigstack sigvec])
+AC_CHECK_MEMBERS([stack_t.ss_sp], [], [],
+[[#include <signal.h>
+#if HAVE_SIGINFO_H
+# include <siginfo.h>
+#endif
+]])
+
+# Code from Jim Avera <jima@netcom.com>.
+# stackovf.c requires:
+# 1. Either sigaction with SA_ONSTACK, or sigvec with SV_ONSTACK
+# 2. Either sigaltstack or sigstack
+# 3. getrlimit, including support for RLIMIT_STACK
+AC_CACHE_CHECK([if stack overflow is detectable], [M4_cv_use_stackovf],
+[M4_cv_use_stackovf=no
+if test "$ac_cv_func_sigaction" = yes || test "$ac_cv_func_sigvec" = yes; then
+ if test "$ac_cv_func_sigaltstack" = yes || test "$ac_cv_func_sigstack" = yes; then
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>
+#include <sys/resource.h>
+#include <signal.h>
+]], [[struct rlimit r; getrlimit (RLIMIT_STACK, &r);
+#if (!defined HAVE_SIGACTION || !defined SA_ONSTACK) \
+ && (!defined HAVE_SIGVEC || !defined SV_ONSTACK)
+choke me /* SA_ONSTACK and/or SV_ONSTACK are not defined */
+#endif
+]])], [M4_cv_use_stackovf=yes])
+ fi
+fi])
+
+AM_CONDITIONAL([STACKOVF], [test "$M4_cv_use_stackovf" = yes])
+if test "$M4_cv_use_stackovf" = yes; then
+ AC_DEFINE([USE_STACKOVF], [1],
+ [Define to 1 if using stack overflow detection.])
+ AC_CHECK_TYPES([rlim_t], [],
+ [AC_DEFINE([rlim_t], [int],
+ [Define to int if rlim_t is not defined in sys/resource.h])],
+ [[#include <sys/resource.h>
+]])
+ AC_CHECK_TYPES([stack_t], [],
+ [AC_DEFINE([stack_t], [struct sigaltstack],
+ [Define to struct sigaltstack if stack_t is not in signal.h])],
+ [[#include <signal.h>
+]])
+ AC_CHECK_TYPES([sigcontext], [], [], [[#include <signal.h>
+]])
+ AC_CHECK_TYPES([siginfo_t], [], [], [[#include <signal.h>
+#if HAVE_SIGINFO_H
+# include <siginfo.h>
+#endif
+]])
+ AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], [], [],
+[[#include <signal.h>
+]])
+
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>
+]],
+ [[struct sigaltstack x; x.ss_base = 0;]])],
+ [AC_DEFINE([ss_sp], [ss_base],
+ [Define to ss_base if stack_t has ss_base instead of ss_sp.])])
+fi
+])# M4_SYS_STACKOVF