diff options
| author | Paul Eggert | 2015-02-20 23:31:17 -0800 |
|---|---|---|
| committer | Paul Eggert | 2015-02-20 23:32:45 -0800 |
| commit | 066b17df681fabb40108d719086669957aebbc51 (patch) | |
| tree | 27f9362ed6a6e68ef6b61925932f84bb1afb37b8 /m4 | |
| parent | 43fb42da8bd6851b5b22d2bbb5d2cd8ceede9c09 (diff) | |
| download | emacs-066b17df681fabb40108d719086669957aebbc51.tar.gz emacs-066b17df681fabb40108d719086669957aebbc51.zip | |
Merge from gnulib
* doc/misc/texinfo.tex: Update from gnulib.
* lib/getdtablesize.c, lib/getopt.c, lib/signal.in.h, lib/tempname.c:
* lib/tempname.h, m4/dup2.m4, m4/fcntl.m4, m4/getdtablesize.m4:
Update from gnulib, incorporating:
2015-02-20 getdtablesize: port better for Android
2015-02-19 fcntl: Fix cross compiling
2015-02-18 dup2, fcntl: cross-compile better for Android
2015-02-18 getopt: don't crash on memory exhaustion
2015-02-17 tempname: allow compilation with C++ (trivial)
2015-02-17 dup2, fcntl: port to AIX
2015-02-16 getdtablesize, dup2, fcntl: port to Android
2015-02-11 getdtablesize, signal_h: Fix Android build
2015-02-11 maint: various whitespace cleanups in tempname
Diffstat (limited to 'm4')
| -rw-r--r-- | m4/dup2.m4 | 76 | ||||
| -rw-r--r-- | m4/fcntl.m4 | 52 | ||||
| -rw-r--r-- | m4/getdtablesize.m4 | 6 |
3 files changed, 71 insertions, 63 deletions
diff --git a/m4/dup2.m4 b/m4/dup2.m4 index 0354c6ad478..9aa2ea85ebd 100644 --- a/m4/dup2.m4 +++ b/m4/dup2.m4 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | #serial 20 | 1 | #serial 22 |
| 2 | dnl Copyright (C) 2002, 2005, 2007, 2009-2015 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2005, 2007, 2009-2015 Free Software Foundation, Inc. |
| 3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
| @@ -8,7 +8,6 @@ AC_DEFUN([gl_FUNC_DUP2], | |||
| 8 | [ | 8 | [ |
| 9 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | 9 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) |
| 10 | AC_REQUIRE([AC_CANONICAL_HOST]) | 10 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 11 | AC_CHECK_FUNCS_ONCE([getdtablesize]) | ||
| 12 | m4_ifdef([gl_FUNC_DUP2_OBSOLETE], [ | 11 | m4_ifdef([gl_FUNC_DUP2_OBSOLETE], [ |
| 13 | AC_CHECK_FUNCS_ONCE([dup2]) | 12 | AC_CHECK_FUNCS_ONCE([dup2]) |
| 14 | if test $ac_cv_func_dup2 = no; then | 13 | if test $ac_cv_func_dup2 = no; then |
| @@ -20,38 +19,44 @@ AC_DEFUN([gl_FUNC_DUP2], | |||
| 20 | if test $HAVE_DUP2 = 1; then | 19 | if test $HAVE_DUP2 = 1; then |
| 21 | AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works], | 20 | AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works], |
| 22 | [AC_RUN_IFELSE([ | 21 | [AC_RUN_IFELSE([ |
| 23 | AC_LANG_PROGRAM([[#include <unistd.h> | 22 | AC_LANG_PROGRAM( |
| 24 | #include <fcntl.h> | 23 | [[#include <errno.h> |
| 25 | #include <errno.h>]], | 24 | #include <fcntl.h> |
| 26 | [int result = 0; | 25 | #include <limits.h> |
| 27 | #ifdef HAVE_GETDTABLESIZE | 26 | #include <sys/resource.h> |
| 28 | int bad_fd = getdtablesize (); | 27 | #include <unistd.h> |
| 29 | #else | 28 | ]], |
| 30 | int bad_fd = 1000000; | 29 | [[int result = 0; |
| 31 | #endif | 30 | int bad_fd = INT_MAX; |
| 32 | #ifdef FD_CLOEXEC | 31 | struct rlimit rlim; |
| 33 | if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1) | 32 | if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 |
| 34 | result |= 1; | 33 | && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX |
| 35 | #endif | 34 | && rlim.rlim_cur != RLIM_INFINITY |
| 36 | if (dup2 (1, 1) == 0) | 35 | && rlim.rlim_cur != RLIM_SAVED_MAX |
| 37 | result |= 2; | 36 | && rlim.rlim_cur != RLIM_SAVED_CUR) |
| 38 | #ifdef FD_CLOEXEC | 37 | bad_fd = rlim.rlim_cur; |
| 39 | if (fcntl (1, F_GETFD) != FD_CLOEXEC) | 38 | #ifdef FD_CLOEXEC |
| 40 | result |= 4; | 39 | if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1) |
| 41 | #endif | 40 | result |= 1; |
| 42 | close (0); | 41 | #endif |
| 43 | if (dup2 (0, 0) != -1) | 42 | if (dup2 (1, 1) == 0) |
| 44 | result |= 8; | 43 | result |= 2; |
| 45 | /* Many gnulib modules require POSIX conformance of EBADF. */ | 44 | #ifdef FD_CLOEXEC |
| 46 | if (dup2 (2, bad_fd) == -1 && errno != EBADF) | 45 | if (fcntl (1, F_GETFD) != FD_CLOEXEC) |
| 47 | result |= 16; | 46 | result |= 4; |
| 48 | /* Flush out some cygwin core dumps. */ | 47 | #endif |
| 49 | if (dup2 (2, -1) != -1 || errno != EBADF) | 48 | close (0); |
| 50 | result |= 32; | 49 | if (dup2 (0, 0) != -1) |
| 51 | dup2 (2, 255); | 50 | result |= 8; |
| 52 | dup2 (2, 256); | 51 | /* Many gnulib modules require POSIX conformance of EBADF. */ |
| 53 | return result; | 52 | if (dup2 (2, bad_fd) == -1 && errno != EBADF) |
| 54 | ]) | 53 | result |= 16; |
| 54 | /* Flush out some cygwin core dumps. */ | ||
| 55 | if (dup2 (2, -1) != -1 || errno != EBADF) | ||
| 56 | result |= 32; | ||
| 57 | dup2 (2, 255); | ||
| 58 | dup2 (2, 256); | ||
| 59 | return result;]]) | ||
| 55 | ], | 60 | ], |
| 56 | [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no], | 61 | [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no], |
| 57 | [case "$host_os" in | 62 | [case "$host_os" in |
| @@ -59,9 +64,6 @@ AC_DEFUN([gl_FUNC_DUP2], | |||
| 59 | gl_cv_func_dup2_works="guessing no" ;; | 64 | gl_cv_func_dup2_works="guessing no" ;; |
| 60 | cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 | 65 | cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 |
| 61 | gl_cv_func_dup2_works="guessing no" ;; | 66 | gl_cv_func_dup2_works="guessing no" ;; |
| 62 | linux*) # On linux between 2008-07-27 and 2009-05-11, dup2 of a | ||
| 63 | # closed fd may yield -EBADF instead of -1 / errno=EBADF. | ||
| 64 | gl_cv_func_dup2_works="guessing no" ;; | ||
| 65 | aix* | freebsd*) | 67 | aix* | freebsd*) |
| 66 | # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE, | 68 | # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE, |
| 67 | # not EBADF. | 69 | # not EBADF. |
diff --git a/m4/fcntl.m4 b/m4/fcntl.m4 index 733cd2d701b..218e78628ba 100644 --- a/m4/fcntl.m4 +++ b/m4/fcntl.m4 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # fcntl.m4 serial 5 | 1 | # fcntl.m4 serial 7 |
| 2 | dnl Copyright (C) 2009-2015 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2009-2015 Free Software Foundation, Inc. |
| 3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
| @@ -19,7 +19,7 @@ AC_DEFUN([gl_FUNC_FCNTL], | |||
| 19 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | 19 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
| 20 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) | 20 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) |
| 21 | AC_REQUIRE([AC_CANONICAL_HOST]) | 21 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 22 | AC_CHECK_FUNCS_ONCE([fcntl getdtablesize]) | 22 | AC_CHECK_FUNCS_ONCE([fcntl]) |
| 23 | if test $ac_cv_func_fcntl = no; then | 23 | if test $ac_cv_func_fcntl = no; then |
| 24 | gl_REPLACE_FCNTL | 24 | gl_REPLACE_FCNTL |
| 25 | else | 25 | else |
| @@ -27,30 +27,34 @@ AC_DEFUN([gl_FUNC_FCNTL], | |||
| 27 | dnl haiku alpha 2 F_DUPFD has wrong errno | 27 | dnl haiku alpha 2 F_DUPFD has wrong errno |
| 28 | AC_CACHE_CHECK([whether fcntl handles F_DUPFD correctly], | 28 | AC_CACHE_CHECK([whether fcntl handles F_DUPFD correctly], |
| 29 | [gl_cv_func_fcntl_f_dupfd_works], | 29 | [gl_cv_func_fcntl_f_dupfd_works], |
| 30 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | 30 | [AC_RUN_IFELSE( |
| 31 | #ifdef HAVE_GETDTABLESIZE | 31 | [AC_LANG_PROGRAM( |
| 32 | # include <unistd.h> | 32 | [[#include <errno.h> |
| 33 | #endif | 33 | #include <fcntl.h> |
| 34 | #include <fcntl.h> | 34 | #include <limits.h> |
| 35 | #include <errno.h> | 35 | #include <sys/resource.h> |
| 36 | ]], [[int result = 0; | 36 | #include <unistd.h> |
| 37 | #ifdef HAVE_GETDTABLESIZE | 37 | ]], |
| 38 | int bad_fd = getdtablesize (); | 38 | [[int result = 0; |
| 39 | #else | 39 | int bad_fd = INT_MAX; |
| 40 | int bad_fd = 1000000; | 40 | struct rlimit rlim; |
| 41 | #endif | 41 | if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 |
| 42 | if (fcntl (0, F_DUPFD, -1) != -1) result |= 1; | 42 | && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX |
| 43 | if (errno != EINVAL) result |= 2; | 43 | && rlim.rlim_cur != RLIM_INFINITY |
| 44 | if (fcntl (0, F_DUPFD, bad_fd) != -1) result |= 4; | 44 | && rlim.rlim_cur != RLIM_SAVED_MAX |
| 45 | if (errno != EINVAL) result |= 8; | 45 | && rlim.rlim_cur != RLIM_SAVED_CUR) |
| 46 | return result; | 46 | bad_fd = rlim.rlim_cur; |
| 47 | ]])], | 47 | if (fcntl (0, F_DUPFD, -1) != -1) result |= 1; |
| 48 | if (errno != EINVAL) result |= 2; | ||
| 49 | if (fcntl (0, F_DUPFD, bad_fd) != -1) result |= 4; | ||
| 50 | if (errno != EINVAL) result |= 8; | ||
| 51 | return result;]])], | ||
| 48 | [gl_cv_func_fcntl_f_dupfd_works=yes], | 52 | [gl_cv_func_fcntl_f_dupfd_works=yes], |
| 49 | [gl_cv_func_fcntl_f_dupfd_works=no], | 53 | [gl_cv_func_fcntl_f_dupfd_works=no], |
| 50 | [# Guess that it works on glibc systems | 54 | [case $host_os in |
| 51 | case $host_os in #(( | 55 | aix* | cygwin* | haiku*) |
| 52 | *-gnu*) gl_cv_func_fcntl_f_dupfd_works="guessing yes";; | 56 | gl_cv_func_fcntl_f_dupfd_works="guessing no" ;; |
| 53 | *) gl_cv_func_fcntl_f_dupfd_works="guessing no";; | 57 | *) gl_cv_func_fcntl_f_dupfd_works="guessing yes" ;; |
| 54 | esac])]) | 58 | esac])]) |
| 55 | case $gl_cv_func_fcntl_f_dupfd_works in | 59 | case $gl_cv_func_fcntl_f_dupfd_works in |
| 56 | *yes) ;; | 60 | *yes) ;; |
diff --git a/m4/getdtablesize.m4 b/m4/getdtablesize.m4 index a6b6c1b6c52..25e9968947d 100644 --- a/m4/getdtablesize.m4 +++ b/m4/getdtablesize.m4 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # getdtablesize.m4 serial 5 | 1 | # getdtablesize.m4 serial 6 |
| 2 | dnl Copyright (C) 2008-2015 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008-2015 Free Software Foundation, Inc. |
| 3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
| @@ -9,7 +9,9 @@ AC_DEFUN([gl_FUNC_GETDTABLESIZE], | |||
| 9 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | 9 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) |
| 10 | AC_REQUIRE([AC_CANONICAL_HOST]) | 10 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 11 | AC_CHECK_FUNCS_ONCE([getdtablesize]) | 11 | AC_CHECK_FUNCS_ONCE([getdtablesize]) |
| 12 | if test $ac_cv_func_getdtablesize = yes; then | 12 | AC_CHECK_DECLS_ONCE([getdtablesize]) |
| 13 | if test $ac_cv_func_getdtablesize = yes && | ||
| 14 | test $ac_cv_have_decl_getdtablesize = yes; then | ||
| 13 | # Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft limit | 15 | # Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft limit |
| 14 | # up to an unchangeable hard limit; all other platforms correctly | 16 | # up to an unchangeable hard limit; all other platforms correctly |
| 15 | # require setrlimit before getdtablesize() can report a larger value. | 17 | # require setrlimit before getdtablesize() can report a larger value. |