summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-05-30 08:24:43 +0200
committerGuido Günther <agx@sigxcpu.org>2016-05-30 08:24:43 +0200
commitd0b310ef8986c26f62a551353c3be435174c474e (patch)
treeadd21d084763a3d9f4d7f75c49bcc9d32d8603e6 /m4
parent6e5223158868af68d5b206443d9c664a15b6c60c (diff)
New upstream version 1.3.5~rc1
Diffstat (limited to 'm4')
-rw-r--r--m4/asm-underscore.m44
-rw-r--r--m4/calloc.m410
-rw-r--r--m4/canonicalize.m49
-rw-r--r--m4/dup.m422
-rw-r--r--m4/dup2.m414
-rw-r--r--m4/extern-inline.m41
-rw-r--r--m4/fcntl.m413
-rw-r--r--m4/getcwd.m44
-rw-r--r--m4/getdelim.m44
-rw-r--r--m4/getgroups.m46
-rw-r--r--m4/getline.m45
-rw-r--r--m4/gnulib-comp.m46
-rw-r--r--m4/hard-locale.m411
-rw-r--r--m4/malloc.m411
-rw-r--r--m4/manywarnings.m414
-rw-r--r--m4/mbrtowc.m450
-rw-r--r--m4/mktime.m422
-rw-r--r--m4/nocrash.m43
-rw-r--r--m4/realloc.m411
-rw-r--r--m4/regex.m44
-rw-r--r--m4/select.m43
-rw-r--r--m4/stdint.m429
-rw-r--r--m4/strndup.m47
-rw-r--r--m4/virt-driver-uml.m455
-rw-r--r--m4/virt-init-script.m475
25 files changed, 358 insertions, 35 deletions
diff --git a/m4/asm-underscore.m4 b/m4/asm-underscore.m4
index ac1ae7c1e..547dd62d2 100644
--- a/m4/asm-underscore.m4
+++ b/m4/asm-underscore.m4
@@ -1,4 +1,4 @@
-# asm-underscore.m4 serial 2
+# asm-underscore.m4 serial 3
dnl Copyright (C) 2010-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -29,7 +29,7 @@ int foo(void) { return 0; }
EOF
# Look for the assembly language name in the .s file.
AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1
- if grep _foo conftest.$gl_asmext >/dev/null ; then
+ if LC_ALL=C grep -E '(^|[^a-zA-Z0-9_])_foo([^a-zA-Z0-9_]|$)' conftest.$gl_asmext >/dev/null; then
gl_cv_prog_as_underscore=yes
else
gl_cv_prog_as_underscore=no
diff --git a/m4/calloc.m4 b/m4/calloc.m4
index 099f9afe2..3109fb26b 100644
--- a/m4/calloc.m4
+++ b/m4/calloc.m4
@@ -1,4 +1,4 @@
-# calloc.m4 serial 15
+# calloc.m4 serial 16
# Copyright (C) 2004-2016 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -25,10 +25,14 @@ AC_DEFUN([_AC_FUNC_CALLOC_IF],
[AC_LANG_PROGRAM(
[AC_INCLUDES_DEFAULT],
[[int result = 0;
- if (!calloc (0, 0))
+ char *p = calloc (0, 0);
+ if (!p)
result |= 1;
- if (calloc ((size_t) -1 / 8 + 1, 8))
+ free (p);
+ p = calloc ((size_t) -1 / 8 + 1, 8);
+ if (p)
result |= 2;
+ free (p);
return result;
]])],
[ac_cv_func_calloc_0_nonnull=yes],
diff --git a/m4/canonicalize.m4 b/m4/canonicalize.m4
index d8f528300..cbbf3e267 100644
--- a/m4/canonicalize.m4
+++ b/m4/canonicalize.m4
@@ -1,4 +1,4 @@
-# canonicalize.m4 serial 26
+# canonicalize.m4 serial 28
dnl Copyright (C) 2003-2007, 2009-2016 Free Software Foundation, Inc.
@@ -83,22 +83,27 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS],
char *name = realpath ("conftest.a", NULL);
if (!(name && *name == '/'))
result |= 1;
+ free (name);
}
{
char *name = realpath ("conftest.b/../conftest.a", NULL);
if (name != NULL)
result |= 2;
+ free (name);
}
{
char *name = realpath ("conftest.a/", NULL);
if (name != NULL)
result |= 4;
+ free (name);
}
{
char *name1 = realpath (".", NULL);
char *name2 = realpath ("conftest.d//./..", NULL);
- if (strcmp (name1, name2) != 0)
+ if (! name1 || ! name2 || strcmp (name1, name2))
result |= 8;
+ free (name1);
+ free (name2);
}
return result;
]])
diff --git a/m4/dup.m4 b/m4/dup.m4
index 4fb0d30be..e30348c8c 100644
--- a/m4/dup.m4
+++ b/m4/dup.m4
@@ -1,4 +1,4 @@
-# dup.m4 serial 3
+# dup.m4 serial 4
dnl Copyright (C) 2011-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -19,6 +19,26 @@ AC_DEFUN([gl_FUNC_DUP],
REPLACE_DUP=1
fi
])
+ AC_CACHE_CHECK([whether dup works], [gl_cv_func_dup_works],
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM([[#include <unistd.h>
+ #include <fcntl.h>
+ #include <errno.h>]],
+ [[/* On OS/2 kLIBC, dup does not work on a directory fd. */
+ int fd = open (".", O_RDONLY);
+ return fd < 0 ? 1 : dup (fd) < 0 ? 2 : 0;
+ ]])
+ ],
+ [gl_cv_func_dup_works=yes],
+ [gl_cv_func_dup_works=no],
+ [gl_cv_func_dup_works='guessing yes'])
+ ])
+ case "$gl_cv_func_dup_works" in
+ *yes) ;;
+ *)
+ REPLACE_DUP=1
+ ;;
+ esac
])
# Prerequisites of lib/dup.c.
diff --git a/m4/dup2.m4 b/m4/dup2.m4
index 63d6d8eb6..5b68312b1 100644
--- a/m4/dup2.m4
+++ b/m4/dup2.m4
@@ -1,4 +1,4 @@
-#serial 24
+#serial 25
dnl Copyright (C) 2002, 2005, 2007, 2009-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -62,6 +62,16 @@ AC_DEFUN([gl_FUNC_DUP2],
result |= 32;
dup2 (2, 255);
dup2 (2, 256);
+ /* On OS/2 kLIBC, dup2() does not work on a directory fd. */
+ {
+ int fd = open (".", O_RDONLY);
+ if (fd == -1)
+ result |= 64;
+ else if (dup2 (fd, fd + 1) == -1)
+ result |= 128;
+
+ close (fd);
+ }
return result;]])
],
[gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no],
@@ -78,6 +88,8 @@ AC_DEFUN([gl_FUNC_DUP2],
gl_cv_func_dup2_works="guessing no" ;;
*-android*) # implemented using dup3(), which fails if oldfd == newfd
gl_cv_func_dup2_works="guessing no" ;;
+ os2*) # on OS/2 kLIBC, dup2() does not work on a directory fd.
+ gl_cv_func_dup2_works="guessing no" ;;
*) gl_cv_func_dup2_works="guessing yes" ;;
esac])
])
diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4
index fe282a56c..1e578f3de 100644
--- a/m4/extern-inline.m4
+++ b/m4/extern-inline.m4
@@ -54,6 +54,7 @@ AC_DEFUN([gl_EXTERN_INLINE],
? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
: (199901L <= __STDC_VERSION__ \
&& !defined __HP_cc \
+ && !defined __PGI \
&& !(defined __SUNPRO_C && __STDC__))) \
&& !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
# define _GL_INLINE inline
diff --git a/m4/fcntl.m4 b/m4/fcntl.m4
index 0037e5fb6..bb61470b2 100644
--- a/m4/fcntl.m4
+++ b/m4/fcntl.m4
@@ -1,4 +1,4 @@
-# fcntl.m4 serial 8
+# fcntl.m4 serial 9
dnl Copyright (C) 2009-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -54,6 +54,17 @@ AC_DEFUN([gl_FUNC_FCNTL],
if (errno != EINVAL) result |= 2;
if (fcntl (0, F_DUPFD, bad_fd) != -1) result |= 4;
if (errno != EINVAL) result |= 8;
+ /* On OS/2 kLIBC, F_DUPFD does not work on a directory fd */
+ {
+ int fd;
+ fd = open (".", O_RDONLY);
+ if (fd == -1)
+ result |= 16;
+ else if (fcntl (fd, F_DUPFD, STDERR_FILENO + 1) == -1)
+ result |= 32;
+
+ close (fd);
+ }
return result;]])],
[gl_cv_func_fcntl_f_dupfd_works=yes],
[gl_cv_func_fcntl_f_dupfd_works=no],
diff --git a/m4/getcwd.m4 b/m4/getcwd.m4
index 2b1c416b9..566c3c13e 100644
--- a/m4/getcwd.m4
+++ b/m4/getcwd.m4
@@ -6,7 +6,7 @@
# with or without modifications, as long as this notice is preserved.
# Written by Paul Eggert.
-# serial 12
+# serial 13
AC_DEFUN([gl_FUNC_GETCWD_NULL],
[
@@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL],
AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result],
[gl_cv_func_getcwd_null],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+# include <stdlib.h>
# if HAVE_UNISTD_H
# include <unistd.h>
# else /* on Windows with MSVC */
@@ -39,6 +40,7 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL],
return 3;
if (f[1] != '\0')
return 4;
+ free (f);
return 0;
}
#endif
diff --git a/m4/getdelim.m4 b/m4/getdelim.m4
index f11195aa2..a1a7dcc52 100644
--- a/m4/getdelim.m4
+++ b/m4/getdelim.m4
@@ -1,4 +1,4 @@
-# getdelim.m4 serial 10
+# getdelim.m4 serial 11
dnl Copyright (C) 2005-2007, 2009-2016 Free Software Foundation, Inc.
dnl
@@ -48,7 +48,9 @@ AC_DEFUN([gl_FUNC_GETDELIM],
size_t siz = (size_t)(~0) / 4;
if (getdelim (&line, &siz, '\n', in) == -1)
return 3;
+ free (line);
}
+ fclose (in);
return 0;
}
]])], [gl_cv_func_working_getdelim=yes] dnl The library version works.
diff --git a/m4/getgroups.m4 b/m4/getgroups.m4
index 4b1573d86..bf01f32ee 100644
--- a/m4/getgroups.m4
+++ b/m4/getgroups.m4
@@ -1,4 +1,4 @@
-# serial 18
+# serial 19
dnl From Jim Meyering.
dnl A wrapper around AC_FUNC_GETGROUPS.
@@ -87,7 +87,9 @@ AC_DEFUN([gl_FUNC_GETGROUPS],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
[[int size = getgroups (0, 0);
gid_t *list = malloc (size * sizeof *list);
- return getgroups (-1, list) != -1;]])],
+ int result = getgroups (-1, list) != -1;
+ free (list);
+ return result;]])],
[gl_cv_func_getgroups_works=yes],
[gl_cv_func_getgroups_works=no],
[case "$host_os" in
diff --git a/m4/getline.m4 b/m4/getline.m4
index 443871f9a..f44751cd4 100644
--- a/m4/getline.m4
+++ b/m4/getline.m4
@@ -1,4 +1,4 @@
-# getline.m4 serial 26
+# getline.m4 serial 27
dnl Copyright (C) 1998-2003, 2005-2007, 2009-2016 Free Software Foundation,
dnl Inc.
@@ -47,6 +47,7 @@ AC_DEFUN([gl_FUNC_GETLINE],
int len = getline (&line, &siz, in);
if (!(len == 4 && line && strcmp (line, "foo\n") == 0))
return 2;
+ free (line);
}
{
/* Test result for a NULL buffer and a non-zero size.
@@ -55,7 +56,9 @@ AC_DEFUN([gl_FUNC_GETLINE],
size_t siz = (size_t)(~0) / 4;
if (getline (&line, &siz, in) == -1)
return 3;
+ free (line);
}
+ fclose (in);
return 0;
}
]])], [am_cv_func_working_getline=yes] dnl The library version works.
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 2bd8597dc..bc4f438cd 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -196,6 +196,7 @@ AC_DEFUN([gl_EARLY],
# Code from module gnumakefile:
# Code from module grantpt:
# Code from module grantpt-tests:
+ # Code from module hard-locale:
# Code from module havelib:
# Code from module hostent:
# Code from module ignore-value:
@@ -761,6 +762,7 @@ AC_SUBST([LTALLOCA])
m4_defn([m4_PACKAGE_VERSION])), [1], [],
[AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
[GNUmakefile=$GNUmakefile])])
+ gl_HARD_LOCALE
gl_HOSTENT
gl_FUNC_INET_NTOP
if test $HAVE_INET_NTOP = 0 || test $REPLACE_INET_NTOP = 1; then
@@ -1773,6 +1775,8 @@ AC_DEFUN([gl_FILE_LIST], [
lib/glthread/lock.c
lib/glthread/lock.h
lib/glthread/threadlib.c
+ lib/hard-locale.c
+ lib/hard-locale.h
lib/ignore-value.h
lib/inet_ntop.c
lib/inet_pton.c
@@ -2016,6 +2020,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/glibc21.m4
m4/gnulib-common.m4
m4/grantpt.m4
+ m4/hard-locale.m4
m4/hostent.m4
m4/include_next.m4
m4/inet_ntop.m4
@@ -2327,6 +2332,7 @@ AC_DEFUN([gl_FILE_LIST], [
tests/test-mbrtowc2.sh
tests/test-mbrtowc3.sh
tests/test-mbrtowc4.sh
+ tests/test-mbrtowc5.sh
tests/test-mbsinit.c
tests/test-mbsinit.sh
tests/test-mbsrtowcs.c
diff --git a/m4/hard-locale.m4 b/m4/hard-locale.m4
new file mode 100644
index 000000000..4661bfc5a
--- /dev/null
+++ b/m4/hard-locale.m4
@@ -0,0 +1,11 @@
+# hard-locale.m4 serial 8
+dnl Copyright (C) 2002-2006, 2009-2016 Free Software Foundation, 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.
+
+dnl No prerequisites of lib/hard-locale.c.
+AC_DEFUN([gl_HARD_LOCALE],
+[
+ :
+])
diff --git a/m4/malloc.m4 b/m4/malloc.m4
index 717e8ad2e..c393690e2 100644
--- a/m4/malloc.m4
+++ b/m4/malloc.m4
@@ -1,4 +1,4 @@
-# malloc.m4 serial 14
+# malloc.m4 serial 15
dnl Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,8 +6,8 @@ dnl with or without modifications, as long as this notice is preserved.
m4_version_prereq([2.70], [] ,[
-# This is taken from the following Autoconf patch:
-# http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9
+# This is adapted with modifications from upstream Autoconf here:
+# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c
AC_DEFUN([_AC_FUNC_MALLOC_IF],
[
AC_REQUIRE([AC_HEADER_STDC])dnl
@@ -23,7 +23,10 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF],
char *malloc ();
#endif
]],
- [[return ! malloc (0);]])
+ [[char *p = malloc (0);
+ int result = !p;
+ free (p);
+ return result;]])
],
[ac_cv_func_malloc_0_nonnull=yes],
[ac_cv_func_malloc_0_nonnull=no],
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index 12d68da6f..90823b0ac 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -1,4 +1,4 @@
-# manywarnings.m4 serial 7
+# manywarnings.m4 serial 8
dnl Copyright (C) 2008-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -129,6 +129,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wdiscarded-qualifiers \
-Wdiv-by-zero \
-Wdouble-promotion \
+ -Wduplicated-cond \
-Wempty-body \
-Wendif-labels \
-Wenum-compare \
@@ -140,7 +141,10 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wformat-signedness \
-Wformat-y2k \
-Wformat-zero-length \
+ -Wframe-address \
-Wfree-nonheap-object \
+ -Whsa \
+ -Wignored-attributes \
-Wignored-qualifiers \
-Wimplicit \
-Wimplicit-function-declaration \
@@ -158,6 +162,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wmain \
-Wmaybe-uninitialized \
-Wmemset-transposed-args \
+ -Wmisleading-indentation \
-Wmissing-braces \
-Wmissing-declarations \
-Wmissing-field-initializers \
@@ -168,6 +173,8 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wnarrowing \
-Wnested-externs \
-Wnonnull \
+ -Wnonnull-compare \
+ -Wnull-dereference \
-Wodr \
-Wold-style-declaration \
-Wold-style-definition \
@@ -184,10 +191,12 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wpragmas \
-Wreturn-local-addr \
-Wreturn-type \
+ -Wscalar-storage-order \
-Wsequence-point \
-Wshadow \
-Wshift-count-negative \
-Wshift-count-overflow \
+ -Wshift-negative-value \
-Wsizeof-array-argument \
-Wsizeof-pointer-memaccess \
-Wstack-protector \
@@ -205,6 +214,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wswitch-default \
-Wsync-nand \
-Wsystem-headers \
+ -Wtautological-compare \
-Wtrampolines \
-Wtrigraphs \
-Wtype-limits \
@@ -237,6 +247,8 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
# them here so that the above 'comm' command doesn't report a false match.
gl_manywarn_set="$gl_manywarn_set -Warray-bounds=2"
gl_manywarn_set="$gl_manywarn_set -Wnormalized=nfc"
+ gl_manywarn_set="$gl_manywarn_set -Wshift-overflow=2"
+ gl_manywarn_set="$gl_manywarn_set -Wunused-const-variable=2"
# These are needed for older GCC versions.
if test -n "$GCC"; then
diff --git a/m4/mbrtowc.m4 b/m4/mbrtowc.m4
index e8c7eebd1..d370fccf0 100644
--- a/m4/mbrtowc.m4
+++ b/m4/mbrtowc.m4
@@ -1,4 +1,4 @@
-# mbrtowc.m4 serial 26 -*- coding: utf-8 -*-
+# mbrtowc.m4 serial 27 -*- coding: utf-8 -*-
dnl Copyright (C) 2001-2002, 2004-2005, 2008-2016 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
@@ -40,6 +40,7 @@ AC_DEFUN([gl_FUNC_MBRTOWC],
gl_MBRTOWC_RETVAL
gl_MBRTOWC_NUL_RETVAL
gl_MBRTOWC_EMPTY_INPUT
+ gl_MBRTOWC_C_LOCALE
case "$gl_cv_func_mbrtowc_null_arg1" in
*yes) ;;
*) AC_DEFINE([MBRTOWC_NULL_ARG1_BUG], [1],
@@ -76,6 +77,13 @@ AC_DEFUN([gl_FUNC_MBRTOWC],
REPLACE_MBRTOWC=1
;;
esac
+ case $gl_cv_C_locale_sans_EILSEQ in
+ *yes) ;;
+ *) AC_DEFINE([C_LOCALE_MAYBE_EILSEQ], [1],
+ [Define to 1 if the C locale may have encoding errors.])
+ REPLACE_MBRTOWC=1
+ ;;
+ esac
fi
fi
])
@@ -577,6 +585,46 @@ changequote([,])dnl
])
])
+dnl Test whether mbrtowc reports encoding errors in the C locale.
+dnl Although POSIX was never intended to allow this, the GNU C Library
+dnl and other implementations do it. See:
+dnl https://sourceware.org/bugzilla/show_bug.cgi?id=19932
+
+AC_DEFUN([gl_MBRTOWC_C_LOCALE],
+[
+ AC_CACHE_CHECK([whether the C locale is free of encoding errors],
+ [gl_cv_C_locale_sans_EILSEQ],
+ [
+ dnl Initial guess, used when cross-compiling or when no suitable locale
+ dnl is present.
+ gl_cv_C_locale_sans_EILSEQ="guessing no"
+
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <limits.h>
+ #include <locale.h>
+ #include <wchar.h>
+ ]], [[
+ int i;
+ char *locale = setlocale (LC_ALL, "C");
+ if (! locale)
+ return 1;
+ for (i = CHAR_MIN; i <= CHAR_MAX; i++)
+ {
+ char c = i;
+ wchar_t wc;
+ mbstate_t mbs = { 0, };
+ size_t ss = mbrtowc (&wc, &c, 1, &mbs);
+ if (1 < ss)
+ return 1;
+ }
+ return 0;
+ ]])],
+ [gl_cv_C_locale_sans_EILSEQ=yes],
+ [gl_cv_C_locale_sans_EILSEQ=no],
+ [:])])
+])
+
# Prerequisites of lib/mbrtowc.c.
AC_DEFUN([gl_PREREQ_MBRTOWC], [
:
diff --git a/m4/mktime.m4 b/m4/mktime.m4
index 78f16ba66..5a0f2d88a 100644
--- a/m4/mktime.m4
+++ b/m4/mktime.m4
@@ -1,4 +1,4 @@
-# serial 25
+# serial 26
dnl Copyright (C) 2002-2003, 2005-2007, 2009-2016 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
@@ -7,9 +7,24 @@ dnl with or without modifications, as long as this notice is preserved.
dnl From Jim Meyering.
+AC_DEFUN([gl_TIME_T_IS_SIGNED],
+[
+ AC_CACHE_CHECK([whether time_t is signed],
+ [gl_cv_time_t_is_signed],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[#include <time.h>
+ char time_t_signed[(time_t) -1 < 0 ? 1 : -1];]])],
+ [gl_cv_time_t_is_signed=yes],
+ [gl_cv_time_t_is_signed=no])])
+ if test $gl_cv_time_t_is_signed = yes; then
+ AC_DEFINE([TIME_T_IS_SIGNED], [1], [Define to 1 if time_t is signed.])
+ fi
+])
+
AC_DEFUN([gl_FUNC_MKTIME],
[
AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
+ AC_REQUIRE([gl_TIME_T_IS_SIGNED])
dnl We don't use AC_FUNC_MKTIME any more, because it is no longer maintained
dnl in Autoconf and because it invokes AC_LIBOBJ.
@@ -169,7 +184,6 @@ main ()
time_t t, delta;
int i, j;
int time_t_signed_magnitude = (time_t) ~ (time_t) 0 < (time_t) -1;
- int time_t_signed = ! ((time_t) 0 < (time_t) -1);
#if HAVE_DECL_ALARM
/* This test makes some buggy mktime implementations loop.
@@ -179,11 +193,11 @@ main ()
alarm (60);
#endif
- time_t_max = (! time_t_signed
+ time_t_max = (! TIME_T_IS_SIGNED
? (time_t) -1
: ((((time_t) 1 << (sizeof (time_t) * CHAR_BIT - 2)) - 1)
* 2 + 1));
- time_t_min = (! time_t_signed
+ time_t_min = (! TIME_T_IS_SIGNED
? (time_t) 0
: time_t_signed_magnitude
? ~ (time_t) 0
diff --git a/m4/nocrash.m4 b/m4/nocrash.m4
index ecc55c617..d8dd8f13a 100644
--- a/m4/nocrash.m4
+++ b/m4/nocrash.m4
@@ -110,11 +110,12 @@ nocrash_init (void)
#else
/* Avoid a crash on POSIX systems. */
#include <signal.h>
+#include <unistd.h>
/* A POSIX signal handler. */
static void
exception_handler (int sig)
{
- exit (1);
+ _exit (1);
}
static void
nocrash_init (void)
diff --git a/m4/realloc.m4 b/m4/realloc.m4
index 7b32ddfb7..fc2282544 100644
--- a/m4/realloc.m4
+++ b/m4/realloc.m4
@@ -1,4 +1,4 @@
-# realloc.m4 serial 13
+# realloc.m4 serial 14
dnl Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,8 +6,8 @@ dnl with or without modifications, as long as this notice is preserved.
m4_version_prereq([2.70], [] ,[
-# This is taken from the following Autoconf patch:
-# http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9
+# This is adapted with modifications from upstream Autoconf here:
+# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c
AC_DEFUN([_AC_FUNC_REALLOC_IF],
[
AC_REQUIRE([AC_HEADER_STDC])dnl
@@ -23,7 +23,10 @@ AC_DEFUN([_AC_FUNC_REALLOC_IF],
char *realloc ();
#endif
]],
- [[return ! realloc (0, 0);]])
+ [[char *p = realloc (0, 0);
+ int result = !p;
+ free (p);
+ return result;]])
],
[ac_cv_func_realloc_0_nonnull=yes],
[ac_cv_func_realloc_0_nonnull=no],
diff --git a/m4/regex.m4 b/m4/regex.m4
index 1996c47b3..abfd262de 100644
--- a/m4/regex.m4
+++ b/m4/regex.m4
@@ -1,4 +1,4 @@
-# serial 65
+# serial 66
# Copyright (C) 1996-2001, 2003-2016 Free Software Foundation, Inc.
#
@@ -93,6 +93,7 @@ AC_DEFUN([gl_REGEX],
0, sizeof data - 1, &regs)
!= -1)
result |= 1;
+ regfree (&regex);
}
{
@@ -124,6 +125,7 @@ AC_DEFUN([gl_REGEX],
if (i != 0 && i != 21)
result |= 1;
}
+ regfree (&regex);
}
if (! setlocale (LC_ALL, "C"))
diff --git a/m4/select.m4 b/m4/select.m4
index 00182fde5..d19365541 100644
--- a/m4/select.m4
+++ b/m4/select.m4
@@ -1,4 +1,4 @@
-# select.m4 serial 7
+# select.m4 serial 8
dnl Copyright (C) 2009-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_SELECT],
[
AC_REQUIRE([gl_HEADER_SYS_SELECT])
+ AC_REQUIRE([AC_C_RESTRICT])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_REQUIRE([gl_SOCKETS])
if test "$ac_cv_header_winsock2_h" = yes; then
diff --git a/m4/stdint.m4 b/m4/stdint.m4
index 0f40ce803..0b4b9060d 100644
--- a/m4/stdint.m4
+++ b/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 43
+# stdint.m4 serial 44
dnl Copyright (C) 2001-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -70,6 +70,8 @@ AC_DEFUN_ONCE([gl_STDINT_H],
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
+#define __STDC_CONSTANT_MACROS 1
+#define __STDC_LIMIT_MACROS 1
#include <stdint.h>
/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */
#if !(defined WCHAR_MIN && defined WCHAR_MAX)
@@ -218,6 +220,8 @@ struct s {
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
+#define __STDC_CONSTANT_MACROS 1
+#define __STDC_LIMIT_MACROS 1
#include <stdint.h>
]
gl_STDINT_INCLUDES
@@ -279,6 +283,29 @@ static const char *macro_values[] =
])
fi
if test "$gl_cv_header_working_stdint_h" = yes; then
+ dnl Now see whether the system <stdint.h> works without
+ dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined.
+ AC_CACHE_CHECK([whether stdint.h predates C++11],
+ [gl_cv_header_stdint_predates_cxx11_h],
+ [gl_cv_header_stdint_predates_cxx11_h=yes
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
+#include <stdint.h>
+]
+gl_STDINT_INCLUDES
+[
+intmax_t im = INTMAX_MAX;
+int32_t i32 = INT32_C (0x7fffffff);
+ ]])],
+ [gl_cv_header_stdint_predates_cxx11_h=no])])
+
+ if test "$gl_cv_header_stdint_predates_cxx11_h" = yes; then
+ AC_DEFINE([__STDC_CONSTANT_MACROS], [1],
+ [Define to 1 if the system <stdint.h> predates C++11.])
+ AC_DEFINE([__STDC_LIMIT_MACROS], [1],
+ [Define to 1 if the system <stdint.h> predates C++11.])
+ fi
STDINT_H=
else
dnl Check for <sys/inttypes.h>, and for
diff --git a/m4/strndup.m4 b/m4/strndup.m4
index de37222c4..ac48a228f 100644
--- a/m4/strndup.m4
+++ b/m4/strndup.m4
@@ -1,4 +1,4 @@
-# strndup.m4 serial 21
+# strndup.m4 serial 22
dnl Copyright (C) 2002-2003, 2005-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -31,11 +31,14 @@ AC_DEFUN([gl_FUNC_STRNDUP],
#endif
char *strndup (const char *, size_t);
#endif
+ int result;
char *s;
s = strndup ("some longer string", 15);
free (s);
s = strndup ("shorter string", 13);
- return s[13] != '\0';]])],
+ result = s[13] != '\0';
+ free (s);
+ return result;]])],
[gl_cv_func_strndup_works=yes],
[gl_cv_func_strndup_works=no],
[
diff --git a/m4/virt-driver-uml.m4 b/m4/virt-driver-uml.m4
new file mode 100644
index 000000000..5c83d76e7
--- /dev/null
+++ b/m4/virt-driver-uml.m4
@@ -0,0 +1,55 @@
+dnl The UML driver
+dnl
+dnl Copyright (C) 2005-2015 Red Hat, Inc.
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library. If not, see
+dnl <http://www.gnu.org/licenses/>.
+dnl
+
+AC_DEFUN([LIBVIRT_DRIVER_CHECK_UML],[
+ AC_ARG_WITH([uml],
+ [AS_HELP_STRING([--with-uml],
+ [add UML support @<:@default=check@:>@])])
+ m4_divert_text([DEFAULTS], [with_uml=check])
+
+ if test "$with_libvirtd" = "no" || test "$with_linux" = "no"; then
+ if test "$with_uml" = "yes"; then
+ AC_MSG_ERROR([The UML driver cannot be enabled])
+ elif test "$with_uml" = "check"; then
+ with_uml="no"
+ fi
+ fi
+
+ if test "$with_uml" = "yes" || test "$with_uml" = "check"; then
+ AC_CHECK_HEADER([sys/inotify.h], [
+ with_uml=yes
+ ], [
+ if test "$with_uml" = "check"; then
+ with_uml=no
+ AC_MSG_NOTICE([<sys/inotify.h> is required for the UML driver, disabling it])
+ else
+ AC_MSG_ERROR([The <sys/inotify.h> is required for the UML driver. Upgrade your libc6.])
+ fi
+ ])
+ fi
+
+ if test "$with_uml" = "yes" ; then
+ AC_DEFINE_UNQUOTED([WITH_UML], 1, [whether UML driver is enabled])
+ fi
+ AM_CONDITIONAL([WITH_UML], [test "$with_uml" = "yes"])
+])
+
+AC_DEFUN([LIBVIRT_DRIVER_RESULT_UML],[
+ AC_MSG_NOTICE([ UML: $with_uml])
+])
diff --git a/m4/virt-init-script.m4 b/m4/virt-init-script.m4
new file mode 100644
index 000000000..c307b0e9b
--- /dev/null
+++ b/m4/virt-init-script.m4
@@ -0,0 +1,75 @@
+dnl Init script type
+dnl
+dnl Copyright (C) 2005-2016 Red Hat, Inc.
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library. If not, see
+dnl <http://www.gnu.org/licenses/>.
+dnl
+
+AC_DEFUN([LIBVIRT_CHECK_INIT_SCRIPT],[
+ AC_ARG_WITH([init-script],
+ [AS_HELP_STRING([--with-init-script@<:@=STYLE@:>@],
+ [Style of init script to install: redhat, systemd, systemd+redhat,
+ upstart, check, none @<:@default=check@:>@])],
+ [],[with_init_script=check])
+
+ AC_MSG_CHECKING([for init script type])
+
+ init_redhat=no
+ init_systemd=no
+ init_upstart=no
+
+ if test "$with_init_script" = check && test "$cross_compiling" = yes; then
+ with_init_script=none
+ fi
+ if test "$with_init_script" = check && type systemctl >/dev/null 2>&1; then
+ with_init_script=systemd
+ fi
+ if test "$with_init_script" = check && test -f /etc/redhat-release; then
+ with_init_script=redhat
+ fi
+ if test "$with_init_script" = check; then
+ with_init_script=none
+ fi
+
+ AS_CASE([$with_init_script],
+ [systemd+redhat],[
+ init_redhat=yes
+ init_systemd=yes
+ ],
+ [systemd],[
+ init_systemd=yes
+ ],
+ [upstart],[
+ init_upstart=yes
+ ],
+ [redhat],[
+ init_redhat=yes
+ ],
+ [none],[],
+ [*],[
+ AC_MSG_ERROR([Unknown initscript flavour $with_init_script])
+ ]
+ )
+
+ AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_RED_HAT], test "$init_redhat" = "yes")
+ AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_UPSTART], test "$init_upstart" = "yes")
+ AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_SYSTEMD], test "$init_systemd" = "yes")
+
+ AC_MSG_RESULT($with_init_script)
+])
+
+AC_DEFUN([LIBVIRT_RESULT_INIT_SCRIPT],[
+ AC_MSG_NOTICE([ Init script: $with_init_script])
+])