From b93bfc9ec608881e9343f1841bf15954808b202c Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Sun, 7 May 2017 08:58:34 +0000 Subject: [PATCH] added header file checks for io multiplexer and dynamic linker in configure.ac --- moo/configure | 25 ++++++++++++++++++++++ moo/configure.ac | 2 ++ moo/lib/main.c | 49 ++++++++++++++++++++++++++++---------------- moo/lib/moo-cfg.h.in | 9 ++++++++ 4 files changed, 67 insertions(+), 18 deletions(-) diff --git a/moo/configure b/moo/configure index 43d3822..fe3bf86 100755 --- a/moo/configure +++ b/moo/configure @@ -18850,6 +18850,31 @@ fi done +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + +for ac_header in sys/devpoll.h sys/epoll.h poll.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + for ac_header in dyncall.h do : ac_fn_c_check_header_mongrel "$LINENO" "dyncall.h" "ac_cv_header_dyncall_h" "$ac_includes_default" diff --git a/moo/configure.ac b/moo/configure.ac index 2850baf..67b9e0a 100644 --- a/moo/configure.ac +++ b/moo/configure.ac @@ -152,6 +152,8 @@ dnl check header files. AC_HEADER_STDC AC_CHECK_HEADERS([stddef.h wchar.h wctype.h errno.h signal.h fcntl.h dirent.h]) AC_CHECK_HEADERS([time.h sys/time.h utime.h spawn.h execinfo.h ucontext.h]) +AC_CHECK_HEADERS([dlfcn.h]) +AC_CHECK_HEADERS([sys/devpoll.h sys/epoll.h poll.h]) AC_CHECK_HEADERS([dyncall.h]) AC_CHECK_HEADERS([xcb/xcb.h]) diff --git a/moo/lib/main.c b/moo/lib/main.c index 8ef7e47..08f6adc 100644 --- a/moo/lib/main.c +++ b/moo/lib/main.c @@ -62,9 +62,11 @@ # if defined(MOO_ENABLE_LIBLTDL) # include # define USE_LTDL -# else +# elif defined(HAVE_DLFCN_H) # include # error NOT IMPLEMENTED +# else +# error UNSUPPORTED DYNAMIC LINKER # endif # if defined(HAVE_TIME_H) @@ -80,27 +82,38 @@ # include # include -#if defined(__sun) && defined(__SVR4) - /* solaris */ -# include -# define USE_DEVPOLL -# define XPOLLIN POLLIN -# define XPOLLOUT POLLOUT -# define XPOLLERR POLLERR -# define XPOLLHUP POLLHUP -#else -# include -# define USE_EPOLL -# define XPOLLIN EPOLLIN -# define XPOLLOUT EPOLLOUT -# define XPOLLERR EPOLLERR -# define XPOLLHUP EPOLLHUP -#endif - # if defined(USE_THREAD) # include # include # endif + +# if defined(HAVE_SYS_DEVPOLL_H) + /* solaris */ +# include +# define USE_DEVPOLL +# define XPOLLIN POLLIN +# define XPOLLOUT POLLOUT +# define XPOLLERR POLLERR +# define XPOLLHUP POLLHUP +# elif defined(HAVE_SYS_EPOLL_H) + /* linux */ +# include +# define USE_EPOLL +# define XPOLLIN EPOLLIN +# define XPOLLOUT EPOLLOUT +# define XPOLLERR EPOLLERR +# define XPOLLHUP EPOLLHUP +# elif defined(HAVE_POLL_H) +# include +# define USE_POLL +# define XPOLLIN POLLIN +# define XPOLLOUT POLLOUT +# define XPOLLERR POLLERR +# define XPOLLHUP POLLHUP +# else +# error UNSUPPORTED MULTIPLEXER +# endif + #endif #if !defined(MOO_DEFAULT_PFMODPREFIX) diff --git a/moo/lib/moo-cfg.h.in b/moo/lib/moo-cfg.h.in index a5917c2..fb5882b 100644 --- a/moo/lib/moo-cfg.h.in +++ b/moo/lib/moo-cfg.h.in @@ -163,6 +163,9 @@ /* Define to 1 if you have the `opendir' function. */ #undef HAVE_OPENDIR +/* Define to 1 if you have the header file. */ +#undef HAVE_POLL_H + /* Define to 1 if you have the `powq' function. */ #undef HAVE_POWQ @@ -238,9 +241,15 @@ /* Define to 1 if you have the `swapcontext' function. */ #undef HAVE_SWAPCONTEXT +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_DEVPOLL_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_DL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EPOLL_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H