Fix build with newer uclibc versions

uClibc master branch, as well as uclibc-ng add eventfd_{read,write}
definitions. Instead of testing for __UCLIBC__, have cmake explicitly check
for the existence of eventfd_read and save the result in
WITH_EVENTFD_READ_WRITE.

Fixes build errors like:

.../winpr/libwinpr/synch/event.c:120:12: error: static declaration of 'eventfd_read' follows non-static declaration
 static int eventfd_read(int fd, eventfd_t* value)
            ^
In file included from .../winpr/libwinpr/synch/event.c:39:0:
.../usr/include/sys/eventfd.h:37:12: note: previous declaration of 'eventfd_read' was here
 extern int eventfd_read (int __fd, eventfd_t *__value);
            ^
.../winpr/libwinpr/synch/event.c:125:12: error: static declaration of 'eventfd_write' follows non-static declaration
 static int eventfd_write(int fd, eventfd_t value)
            ^
In file included from .../winpr/libwinpr/synch/event.c:39:0:
.../usr/include/sys/eventfd.h:40:12: note: previous declaration of 'eventfd_write' was here
 extern int eventfd_write (int __fd, eventfd_t __value);
This commit is contained in:
Baruch Siach
2015-04-28 09:30:45 +03:00
parent 1fea6bf702
commit 3b7d3190a1
5 changed files with 8 additions and 3 deletions

View File

@@ -451,6 +451,9 @@ endif()
if(UNIX OR CYGWIN)
check_include_files(sys/eventfd.h HAVE_AIO_H)
check_include_files(sys/eventfd.h HAVE_EVENTFD_H)
if (HAVE_EVENTFD_H)
check_symbol_exists(eventfd_read sys/eventfd.h WITH_EVENTFD_READ_WRITE)
endif()
check_include_files(sys/timerfd.h HAVE_TIMERFD_H)
check_include_files(poll.h HAVE_POLL_H)
set(X11_FEATURE_TYPE "RECOMMENDED")

View File

@@ -45,6 +45,7 @@
#cmakedefine WITH_JPEG
#cmakedefine WITH_WIN8
#cmakedefine WITH_RDPSND_DSOUND
#cmakedefine WITH_EVENTFD_READ_WRITE
#cmakedefine WITH_FFMPEG
#cmakedefine WITH_GSTREAMER_1_0

View File

@@ -1535,7 +1535,7 @@ BOOL CommCloseHandle(HANDLE handle)
return TRUE;
}
#ifdef __UCLIBC__
#ifndef WITH_EVENTFD_READ_WRITE
int eventfd_read(int fd, eventfd_t* value)
{
return (read(fd, value, sizeof(*value)) == sizeof(*value)) ? 0 : -1;

View File

@@ -29,6 +29,7 @@
#include <winpr/comm.h>
#include "../handle/handle.h"
#include "config.h"
struct winpr_comm
{
@@ -97,7 +98,7 @@ void CommLog_Print(int wlog_level, char *fmt, ...);
BOOL CommIsHandled(HANDLE handle);
BOOL CommCloseHandle(HANDLE handle);
#ifdef __UCLIBC__
#ifndef WITH_EVENTFD_READ_WRITE
int eventfd_read(int fd, eventfd_t* value);
int eventfd_write(int fd, eventfd_t value);
#endif

View File

@@ -183,7 +183,7 @@ HANDLE OpenEventA(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName)
}
#ifdef HAVE_EVENTFD_H
#if defined(__UCLIBC__)
#if !defined(WITH_EVENTFD_READ_WRITE)
static int eventfd_read(int fd, eventfd_t* value)
{
return (read(fd, value, sizeof(*value)) == sizeof(*value)) ? 0 : -1;