errno 38 is ENOSYS, it seems the epoll_ctl system call is not
implemented on your target kernel. You say that running "make test"
works though?

On the build host, which has a 2.6 kernel. The kernel on the target host is
2.4 (which doesn't have epoll).

That's pretty strange. You'll probably have to set
ac_cv_header_sys_epoll_h = no and rerun configure. The configure script
checks that epoll_create() works, strange that it would succeed but
epoll_ctl() fails.

I've changed the package to set ac_cv_header_sys_epoll_h = no when building
for a target system with a 2.4 kernel, which has fixed that for me.

However, build-time checks on kernel features may not be the most robust
solution.

Ahem. The very nature of autoconf is to perform build-time checks on the
build machine, for library and kernel features. E.g., all the checks we
do to see if pthreads, regex, etc. works...

The fact is that you actually have what should be treated as a
cross-compilation setup. When cross-compiling, configure defaults most
of these feature tests to "no" anyway, but your problem is how to get
configure to recognize that it should be in a cross-compile mode, since
the host *architecture* is the same. In other words, you're trying to do
something that autoconf isn't designed to handle automatically.