From 01fc5978d3e81bd488762937e9302cc6baf69a20 Mon Sep 17 00:00:00 2001 From: Gabriele Svelto Date: Tue, 3 Apr 2012 10:37:00 +0200 Subject: 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 --- acinclude.m4 | 18 +++++++++++++++--- configure.ac | 2 +- 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. -- cgit v1.2.3