Add test to configure to avoid using the broken poll implementation on

Mac OS X 10.4 and later, which does not support devices.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28377 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
wlux 2009-06-30 20:47:17 +00:00
parent 1a80eb6657
commit 62edc2e493
4 changed files with 86 additions and 1 deletions

View file

@ -1,3 +1,11 @@
2009-06-30 Wolfgang Lux <wolfgang.lux@gmail.com>
* configure.ac:
* configure:
* config/config.poll-dev.c: Add test to configure to avoid using
the broken poll implementation on Mac OS X 10.4 and later, which
does not support devices.
2009-06-24 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSXMLParser.m: ([-parse]) don't split whitespace strings

24
config/config.poll-dev.c Normal file
View file

@ -0,0 +1,24 @@
/* Mac OS X has a native poll implementation since Mac OS X 10.4, but
* this implementation is broken in (at least) OS X 10.4 and 10.5 in
* that it does not support devices.
*/
#include <stdio.h>
#include <fcntl.h>
#include <poll.h>
int
main()
{
int fd, n;
struct pollfd pollfds[1];
fd = open("/dev/null", O_RDONLY | O_NONBLOCK, 0);
pollfds[0].fd = fd;
pollfds[0].events = POLLIN;
n = poll(pollfds, 1, 0);
close(fd);
return (n == 1 && !(pollfds[0].revents & POLLNVAL)) ? 0 : 1;
}

46
configure vendored
View file

@ -11743,11 +11743,57 @@ rm -f conftest*
if test $have_poll = yes; then
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
echo "$as_me:$LINENO: checking if poll supports devices" >&5
echo $ECHO_N "checking if poll supports devices... $ECHO_C" >&6
if test "$cross_compiling" = yes; then
{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
See \`config.log' for more details." >&5
echo "$as_me: error: cannot run test program while cross compiling
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include "$srcdir/config/config.poll-dev.c"
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
have_poll=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
if test $have_poll = yes; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
cat >>confdefs.h <<\_ACEOF
#define HAVE_POLL_F 1
_ACEOF
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
else
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6

View file

@ -817,7 +817,14 @@ if test $ac_cv_header_poll_h = yes; then
have_poll=no,)
if test $have_poll = yes; then
AC_MSG_RESULT(no)
AC_DEFINE(HAVE_POLL_F,1, [ Define if poll is NOT emulated via select])
AC_MSG_CHECKING([if poll supports devices])
AC_TRY_RUN([#include "$srcdir/config/config.poll-dev.c"], ,have_poll=no, )
if test $have_poll = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_POLL_F,1, [ Define if poll is NOT emulated via select])
else
AC_MSG_RESULT(no)
fi
else
AC_MSG_RESULT(yes)
fi