On 31 March 2013 13:46, Michael W. Bombardieri <m...@ii.net> wrote:
> What about this?
>
> Re-use the exting the pthread checker code in 'configure', define HAS_PTHREAD
> and use this instead of OS specific #if checks. I have built this on
>
> 1. Ubuntu 10.04.3 LTS (Linux 2.6.32-36-generic i686)
> 2. OpenBSD 5.1 (OpenBSD 5.1 GENERIC.MP#188 i386)
> 3. OpenBSD 5.1 (OpenBSD 5.1 GENERIC#243 amd64)

This doesn't look right, because it means we'll use the fallback
code even for OSes like Linux which do have the ability to use
the (preferable) semaphore code. You want a config check for
sem_timedwait, which will succeed on Linux and fail on the BSDs,
and then instead of #if defined(various BSDs) you have
#ifndef CONFIG_SEM_TIMEDWAIT.

> +if [ $pthread = 'yes' ]; then
> +  QEMU_CFLAGS="-DHAS_PTHREAD $QEMU_CFLAGS"
> +fi
> +

Have a look in configure at how we handle the preadv()
check as an example. There's a little test program
which is compiled to see if the function exists, and
we set a shell variable. Then later on we write CONFIG_PREADV=y
to the config-host.mak file. This avoids enormous compiler
command lines for every config check.

Also you still aren't providing a Signed-off-by: line for
your patch, and it would be nice if you could submit
it in the git format-patch format that makes it trivial
to apply.

thanks
-- PMM

Reply via email to