[Xcb-commit] configure.ac

Vincent Torri vtorri at univ-evry.fr
Fri Mar 4 12:56:06 PST 2011



On Fri, 4 Mar 2011, Jeremy Huddleston wrote:

> configure.ac |   19 +++++++++++++++++--
> 1 file changed, 17 insertions(+), 2 deletions(-)
>
> New commits:
> commit 8c3325f8bbdb1e8975bdb01525a52d6b0f80cfa3
> Author: Jeremy Huddleston <jeremyhu at apple.com>
> Date:   Fri Mar 4 12:41:55 2011 -0800
>
>    darwin: Don't use poll() when expected to run on darwin10 and prior
>
>    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
>
> diff --git a/configure.ac b/configure.ac
> index a8e171b..b8d5471 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -131,8 +131,23 @@ AC_PREREQ([2.59c], [], [AC_SUBST([htmldir], [m4_ifset([AC_PACKAGE_TARNAME],
> XCB_CHECK_DOXYGEN()
>
> case $host_os in
> -	# darwin has poll() but can't be used to poll character devices (atleast through SnowLeopard)
> -	darwin*) ;;
> +	# darwin through Snow Leopard has poll() but can't be used to poll character devices.

the patch below is not the best we can have. The usual way to check stuff 
like that (a function working or not) is by writing a test case and 
running it, and not by testing versions of OS. Something like

AC_RUN_IFELSE(
    [
     AC_LANG_PROGRAM(
        [
/* prologue (include, global var) */
        ],
        [
/* body (what is in main() )*/
/* return 0 on success */
        ])
    ],
    [have_good_poll="yes"]
    [have_good_poll="no"])

So if it is possible to know if poll()  behaves correctly with a program, 
use something like what i wrote.

Also, if I'm not mistaken, Windows does not have poll(), so case is not 
good. Again, using AC_COMPILE_IFELSE is better to check the availability 
of poll()

Vincent

> +	darwin@<:@789@:>@*|darwin10*) ;;
> +	darwin*)
> +		_ac_xorg_macosx_version_min=""
> +		if echo $CPPFLAGS $CFLAGS | grep -q mmacosx-version-min ; then
> +			_ac_xorg_macosx_version_min=`echo $CPPFLAGS $CFLAGS | sed 's/^.*-mmacosx-version-min=\(@<:@^ @:>@*\).*$/\1/'`
> +		else
> +			_ac_xorg_macosx_version_min=$MACOSX_DEPLOYMENT_TARGET
> +		fi
> +		case $_ac_xorg_macosx_version_min in
> +			10.@<:@0123456@:>@|10.@<:@0123456@:>@.*) ;;
> +			*)
> +				AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
> +			;;
> +		esac
> +		unset _ac_xorg_macosx_version_min
> +		;;
> 	*)
> 		AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
> 	;;
> _______________________________________________
> xcb-commit mailing list
> xcb-commit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb-commit
>
>


More information about the xcb-commit mailing list