X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Fposix_spawn.m4;h=57928ebca050001e74bb9f3e2b966bed6c748bac;hb=f9788546de646fbc4f77bba502a8f815d4999bac;hp=d0a734d09bdc9092e6ad3bb66928134d1069bf77;hpb=3f89a5e2c8f6fc011f525980ff99936a4b0445d0;p=gnulib.git diff --git a/m4/posix_spawn.m4 b/m4/posix_spawn.m4 index d0a734d09..57928ebca 100644 --- a/m4/posix_spawn.m4 +++ b/m4/posix_spawn.m4 @@ -1,4 +1,4 @@ -# posix_spawn.m4 serial 10 +# posix_spawn.m4 serial 11 dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -482,3 +482,46 @@ int main () esac fi ]) + +AC_DEFUN([gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN], +[ + AC_REQUIRE([gl_SPAWN_H_DEFAULTS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + gl_POSIX_SPAWN + if test $REPLACE_POSIX_SPAWN = 1; then + REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=1 + else + dnl On Solaris 11 2011-11, posix_spawn_file_actions_addopen succeeds even + dnl if the fd argument is out of range. + AC_CACHE_CHECK([whether posix_spawn_file_actions_addopen works], + [gl_cv_func_posix_spawn_file_actions_addopen_works], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +int main () +{ + posix_spawn_file_actions_t actions; + if (posix_spawn_file_actions_init (&actions) != 0) + return 1; + if (posix_spawn_file_actions_addopen (&actions, 10000000, "foo", 0, O_RDONLY) + == 0) + return 2; + return 0; +}]])], + [gl_cv_func_posix_spawn_file_actions_addopen_works=yes], + [gl_cv_func_posix_spawn_file_actions_addopen_works=no], + [# Guess no on Solaris, yes otherwise. + case "$host_os" in + solaris*) gl_cv_func_posix_spawn_file_actions_addopen_works="guessing no";; + *) gl_cv_func_posix_spawn_file_actions_addopen_works="guessing yes";; + esac + ]) + ]) + case "$gl_cv_func_posix_spawn_file_actions_addopen_works" in + *yes) ;; + *) REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=1 ;; + esac + fi +])