build: Include correct poll.h

Including sys/poll.h when poll.h is available produces a compile
warning on some systems, but only sys/poll.h is present on others
such as AIX. This makes sure the most suitable poll.h is included
in each situation.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
This commit is contained in:
George Matsumura 2020-08-31 01:36:20 -06:00
parent 3b1bf9d6d3
commit 9a3ad1df1c
5 changed files with 26 additions and 5 deletions

View file

@ -88,7 +88,7 @@ AC_CHECK_HEADERS([stdint.h inttypes.h sys/int_types.h])
AC_CHECK_TYPES([uint64_t, uint128_t, __uint128_t]) AC_CHECK_TYPES([uint64_t, uint128_t, __uint128_t])
dnl Check for socket support for any2ppm daemon dnl Check for socket support for any2ppm daemon
AC_CHECK_HEADERS([fcntl.h unistd.h signal.h sys/stat.h sys/socket.h sys/poll.h sys/un.h]) AC_CHECK_HEADERS([fcntl.h unistd.h signal.h poll.h sys/stat.h sys/socket.h sys/poll.h sys/un.h])
dnl Check for infinite loops dnl Check for infinite loops
AC_CHECK_FUNCS([alarm]) AC_CHECK_FUNCS([alarm])

View file

@ -44,6 +44,7 @@ check_headers = [
['signal.h'], ['signal.h'],
['sys/stat.h'], ['sys/stat.h'],
['sys/socket.h'], ['sys/socket.h'],
['poll.h'],
['sys/poll.h'], ['sys/poll.h'],
['sys/un.h'], ['sys/un.h'],
['sched.h', {'check-funcs': ['sched_getaffinity']}], ['sched.h', {'check-funcs': ['sched_getaffinity']}],

View file

@ -85,13 +85,18 @@
#include <fcntl.h> #include <fcntl.h>
#endif #endif
#if HAVE_UNISTD_H && HAVE_SIGNAL_H && HAVE_SYS_STAT_H && HAVE_SYS_SOCKET_H && HAVE_SYS_POLL_H && HAVE_SYS_UN_H #if HAVE_UNISTD_H && HAVE_SIGNAL_H && HAVE_SYS_STAT_H && HAVE_SYS_SOCKET_H && (HAVE_POLL_H || HAVE_SYS_POLL_H) && HAVE_SYS_UN_H
#include <signal.h> #include <signal.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/poll.h>
#include <sys/un.h> #include <sys/un.h>
#if defined(HAVE_POLL_H)
#include <poll.h>
#elif defined(HAVE_SYS_POLL_H)
#include <sys/poll.h>
#endif
#define SOCKET_PATH "./.any2ppm" #define SOCKET_PATH "./.any2ppm"
#define TIMEOUT 60000 /* 60 seconds */ #define TIMEOUT 60000 /* 60 seconds */

View file

@ -79,15 +79,23 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/poll.h>
#include <sys/un.h> #include <sys/un.h>
#include <errno.h> #include <errno.h>
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#if CAIRO_HAS_REAL_PTHREAD #if CAIRO_HAS_REAL_PTHREAD
#include <pthread.h> #include <pthread.h>
#endif #endif
#if defined(HAVE_POLL_H)
#include <poll.h>
#elif defined(HAVE_SYS_POLL_H)
#include <sys/poll.h>
#else
#error No poll.h equivalent found
#endif
#if HAVE_FCFINI #if HAVE_FCFINI
#include <fontconfig/fontconfig.h> #include <fontconfig/fontconfig.h>
#endif #endif

View file

@ -15,7 +15,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/poll.h>
#include <sys/un.h> #include <sys/un.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
@ -24,6 +23,14 @@
#include <assert.h> #include <assert.h>
#include <pthread.h> #include <pthread.h>
#if defined(HAVE_POLL_H)
#include <poll.h>
#elif defined(HAVE_SYS_POLL_H)
#include <sys/poll.h>
#else
#error No poll.h equivalent found
#endif
#include <cairo.h> #include <cairo.h>
#include <cairo-script.h> #include <cairo-script.h>
#include <cairo-script-interpreter.h> #include <cairo-script-interpreter.h>