diff --git a/ChangeLog b/ChangeLog index 57755510a..8e4068743 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-03-26 Marius Vollmer + + * configure.in: Added check that defines + PTHREAD_ATTR_GETSTACK_WORKS when pthread_attr_getstack works for + the main thread. + 2006-02-26 Kevin Ryde * configure.in (AC_CHECK_FUNCS): Add dirfd. diff --git a/configure.in b/configure.in index 6ef482f73..602cb1d56 100644 --- a/configure.in +++ b/configure.in @@ -1026,6 +1026,44 @@ esac AC_MSG_CHECKING(what kind of threads to support) AC_MSG_RESULT($with_threads) +## Check whether pthread_attr_getstack works for the main thread + +AC_MSG_CHECKING(whether pthread_attr_getstack works for the main thread) +old_CFLAGS="$CFLAGS" +CFLAGS="$PTHREAD_CFLAGS $CFLAGS" +AC_TRY_RUN( +[ +#if HAVE_PTHREAD_ATTR_GETSTACK +#include + +int main () +{ + pthread_attr_t attr; + void *start, *end; + size_t size; + + pthread_getattr_np (pthread_self (), &attr); + pthread_attr_getstack (&attr, &start, &size); + end = (char *)start + size; + + if ((void *)&attr < start || (void *)&attr >= end) + return 1; + else + return 0; +} +#else +int main () +{ + return 1; +} +#endif +], +[works=yes +AC_DEFINE(PTHREAD_ATTR_GETSTACK_WORKS, [1], [Define when pthread_att_get_stack works for the main thread])], +[works=no]) +CFLAGS="$old_CFLAGS" +AC_MSG_RESULT($works) + ## Cross building if test "$cross_compiling" = "yes"; then AC_MSG_CHECKING(cc for build)