aboutsummaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/manywarnings.m432
-rw-r--r--m4/pselect.m440
-rw-r--r--m4/stdlib_h.m41
-rw-r--r--m4/sys_stat_h.m45
4 files changed, 69 insertions, 9 deletions
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index 2760efb3f27..f3cb23be1cd 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -1,4 +1,4 @@
1# manywarnings.m4 serial 4 1# manywarnings.m4 serial 5
2dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. 2dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -35,14 +35,12 @@ AC_DEFUN([gl_MANYWARN_COMPLEMENT],
35# make sure your gcc understands it. 35# make sure your gcc understands it.
36AC_DEFUN([gl_MANYWARN_ALL_GCC], 36AC_DEFUN([gl_MANYWARN_ALL_GCC],
37[ 37[
38 dnl First, check if -Wno-missing-field-initializers is needed. 38 dnl First, check for some issues that only occur when combining multiple
39 dnl -Wmissing-field-initializers is implied by -W, but that issues 39 dnl gcc warning categories.
40 dnl warnings with GCC version before 4.7, for the common idiom
41 dnl of initializing types on the stack to zero, using { 0, }
42 AC_REQUIRE([AC_PROG_CC]) 40 AC_REQUIRE([AC_PROG_CC])
43 if test -n "$GCC"; then 41 if test -n "$GCC"; then
44 42
45 dnl First, check -W -Werror -Wno-missing-field-initializers is supported 43 dnl Check if -W -Werror -Wno-missing-field-initializers is supported
46 dnl with the current $CC $CFLAGS $CPPFLAGS. 44 dnl with the current $CC $CFLAGS $CPPFLAGS.
47 AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported]) 45 AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported])
48 AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [ 46 AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [
@@ -77,8 +75,24 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
77 ]) 75 ])
78 AC_MSG_RESULT([$gl_cv_cc_nomfi_needed]) 76 AC_MSG_RESULT([$gl_cv_cc_nomfi_needed])
79 fi 77 fi
78
79 dnl Next, check if -Werror -Wuninitialized is useful with the
80 dnl user's choice of $CFLAGS; some versions of gcc warn that it
81 dnl has no effect if -O is not also used
82 AC_MSG_CHECKING([whether -Wuninitialized is supported])
83 AC_CACHE_VAL([gl_cv_cc_uninitialized_supported], [
84 gl_save_CFLAGS="$CFLAGS"
85 CFLAGS="$CFLAGS -Werror -Wuninitialized"
86 AC_COMPILE_IFELSE(
87 [AC_LANG_PROGRAM([[]], [[]])],
88 [gl_cv_cc_uninitialized_supported=yes],
89 [gl_cv_cc_uninitialized_supported=no])
90 CFLAGS="$gl_save_CFLAGS"])
91 AC_MSG_RESULT([$gl_cv_cc_uninitialized_supported])
92
80 fi 93 fi
81 94
95 # List all gcc warning categories.
82 gl_manywarn_set= 96 gl_manywarn_set=
83 for gl_manywarn_item in \ 97 for gl_manywarn_item in \
84 -W \ 98 -W \
@@ -197,10 +211,14 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
197 gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" 211 gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
198 done 212 done
199 213
200 # Disable the missing-field-initializers warning if needed 214 # Disable specific options as needed.
201 if test "$gl_cv_cc_nomfi_needed" = yes; then 215 if test "$gl_cv_cc_nomfi_needed" = yes; then
202 gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" 216 gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
203 fi 217 fi
204 218
219 if test "$gl_cv_cc_uninitialized_supported" = no; then
220 gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized"
221 fi
222
205 $1=$gl_manywarn_set 223 $1=$gl_manywarn_set
206]) 224])
diff --git a/m4/pselect.m4 b/m4/pselect.m4
index 97bf12cd2d6..5edacd28f85 100644
--- a/m4/pselect.m4
+++ b/m4/pselect.m4
@@ -1,4 +1,4 @@
1# pselect.m4 1# pselect.m4 serial 2
2dnl Copyright (C) 2011-2012 Free Software Foundation, Inc. 2dnl Copyright (C) 2011-2012 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -23,6 +23,44 @@ AC_DEFUN([gl_FUNC_PSELECT],
23 return !p;]])], 23 return !p;]])],
24 [gl_cv_sig_pselect=yes], 24 [gl_cv_sig_pselect=yes],
25 [gl_cv_sig_pselect=no])]) 25 [gl_cv_sig_pselect=no])])
26
27 dnl On FreeBSD 8.2, pselect() doesn't always reject bad fds.
28 AC_CACHE_CHECK([whether pselect detects invalid fds],
29 [gl_cv_func_pselect_detects_ebadf],
30 [
31 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
32#include <sys/types.h>
33#include <sys/time.h>
34#if HAVE_SYS_SELECT_H
35# include <sys/select.h>
36#endif
37#include <unistd.h>
38#include <errno.h>
39]],[[
40 fd_set set;
41 dup2(0, 16);
42 FD_ZERO(&set);
43 FD_SET(16, &set);
44 close(16);
45 struct timespec timeout;
46 timeout.tv_sec = 0;
47 timeout.tv_nsec = 5000;
48 return pselect (17, &set, NULL, NULL, &timeout, NULL) != -1 || errno != EBADF;
49]])], [gl_cv_func_pselect_detects_ebadf=yes],
50 [gl_cv_func_pselect_detects_ebadf=no],
51 [
52 case "$host_os" in
53 # Guess yes on glibc systems.
54 *-gnu*) gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
55 # If we don't know, assume the worst.
56 *) gl_cv_func_pselect_detects_ebadf="guessing no" ;;
57 esac
58 ])
59 ])
60 case $gl_cv_func_pselect_detects_ebadf in
61 *yes) ;;
62 *) REPLACE_PSELECT=1 ;;
63 esac
26 fi 64 fi
27 65
28 if test $ac_cv_func_pselect = no || test $gl_cv_sig_pselect = no; then 66 if test $ac_cv_func_pselect = no || test $gl_cv_sig_pselect = no; then
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4
index ab43728ace4..9c69f2e4d15 100644
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -102,6 +102,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
102 REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) 102 REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC])
103 REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) 103 REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC])
104 REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) 104 REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
105 REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME])
105 REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) 106 REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R])
106 REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) 107 REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
107 REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) 108 REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R])
diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4
index 8af3353ea51..f45dee1dc4d 100644
--- a/m4/sys_stat_h.m4
+++ b/m4/sys_stat_h.m4
@@ -1,4 +1,4 @@
1# sys_stat_h.m4 serial 28 -*- Autoconf -*- 1# sys_stat_h.m4 serial 27 -*- Autoconf -*-
2dnl Copyright (C) 2006-2012 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2012 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -11,6 +11,9 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
11[ 11[
12 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) 12 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
13 13
14 dnl For the mkdir substitute.
15 AC_REQUIRE([AC_C_INLINE])
16
14 dnl Check for broken stat macros. 17 dnl Check for broken stat macros.
15 AC_REQUIRE([AC_HEADER_STAT]) 18 AC_REQUIRE([AC_HEADER_STAT])
16 19