summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriele Svelto <gabriele.svelto@gmail.com>2012-04-03 10:37:00 +0200
committerMartin Sustrik <sustrik@250bpm.com>2012-04-04 04:30:54 +0200
commit01fc5978d3e81bd488762937e9302cc6baf69a20 (patch)
treef67a2f884caa5d2575887414f199dedc97de1247
parent04dafcc608d8030872eb110565789ad6bd741137 (diff)
Define the XS_HAVE_* poller macros in a more robust way
The existing code for definining the XS_HAVE_* macros for the polling mechanism may fail if the platform's `tr' command does not support the GNU syntax. Replacing the hand-made declaration with autoconf macros yields the same results on all platforms. Signed-off-by: Gabriele Svelto <gabriele.svelto@gmail.com>
-rw-r--r--acinclude.m418
-rw-r--r--configure.ac2
2 files changed, 16 insertions, 4 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 0c7b1e0..a1c1cbe 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -721,6 +721,13 @@ dnl # Choose polling system
dnl ################################################################################
AC_DEFUN([LIBXS_CHECK_POLLER], [{
+ # Templates to be picked up by autoheader
+ AH_TEMPLATE([XS_HAVE_KQUEUE], [Defined to 1 if your system has kqueue()])
+ AH_TEMPLATE([XS_HAVE_EPOLL], [Defined to 1 if your system has epoll()])
+ AH_TEMPLATE([XS_HAVE_DEVPOLL], [Defined to 1 if your system has /dev/poll])
+ AH_TEMPLATE([XS_HAVE_POLL], [Defined to 1 if your system has poll()])
+ AH_TEMPLATE([XS_HAVE_SELECT], [Defined to 1 if your system has select()])
+
# Allow user to disable doc build
AC_ARG_WITH([poller], [AS_HELP_STRING([--with-poller],
[choose polling system manually. valid values are kqueue, epoll, devpoll, poll or select [default=autodetect]])])
@@ -767,9 +774,14 @@ AC_DEFUN([LIBXS_CHECK_POLLER], [{
;;
esac
- libxs_cv_poller_flag=`echo "XS_HAVE_${libxs_cv_poller}" | tr a-z A-Z`
+ AS_IF([test "x${libxs_cv_poller}" != "x"], [
+ AC_MSG_RESULT([using $libxs_cv_poller])
+ $1
+ ], [
+ AC_MSG_RESULT([no suitable polling system found])
+ $2
+ ])
- AS_IF([test "x${libxs_cv_poller}" != "x"],
- [AC_MSG_RESULT([using $libxs_cv_poller]) ; $1], [AC_MSG_RESULT(no suitable polling system found) ; $2])
+ AC_DEFINE_UNQUOTED(AS_TR_CPP(xs_have_${libxs_cv_poller}))
}])
diff --git a/configure.ac b/configure.ac
index df5e89f..42c6332 100644
--- a/configure.ac
+++ b/configure.ac
@@ -231,7 +231,7 @@ AS_CASE(["${host_cpu}"],
LIBXS_CHECK_DOC_BUILD
# Check polling system
-LIBXS_CHECK_POLLER([CPPFLAGS="${CPPFLAGS} -D${libxs_cv_poller_flag}"],
+LIBXS_CHECK_POLLER([],
[AC_MSG_ERROR([Unable to continue without polling system])])
# Checks for header files.