[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to check the size of pthread_t?
From: |
Ralf Wildenhues |
Subject: |
Re: How to check the size of pthread_t? |
Date: |
Fri, 27 Feb 2009 18:25:23 +0100 |
User-agent: |
Mutt/1.5.17+20080114 (2008-01-14) |
Hello Vasil,
* Vasil Dimov wrote on Fri, Feb 27, 2009 at 07:47:49AM CET:
>
> I am trying to create an autoconf script that does check the size of
> pthread_t,
> but I am experiencing some troubles in the way.
>
> To be precise, what I need is a macro like SIZEOF_PTHREAD_T, similar to
> SIZEOF_LONG. The problem is that pthread.h must be included in the test
> program
> and it must be linked with the OS-dependent -pthread or -lpthread or
> whatever flag
> the OS is using to link against the POSIX threads library.
>
> Can anyone send me a quick snippet of autoconf magic how to achieve this?
Completely untested: grab the ACX_PTHREAD macro from the Autoconf Macro
Archive, then use something like this:
ACX_PTHREAD
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
AC_CHECK_SIZEOF([pthread_t], [],
[AC_INCLUDES_DEFAULT
#include <pthread.h>
])
If you don't want LIBS, CFLAGS, and CC mangled, then save and restore
their values before resp. afterwards.
Hope that helps (otherwise please report back).
Cheers,
Ralf