Patch #732234: Check for -Kthread.

This commit is contained in:
Martin v. Löwis 2003-05-05 05:05:30 +00:00
parent 0389295dcd
commit 5f433f0ef4
2 changed files with 113 additions and 1 deletions

75
configure vendored
View file

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Revision: 1.404 .
# From configure.in Revision: 1.405 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53 for python 2.3.
#
@ -3878,6 +3878,68 @@ echo "$as_me:$LINENO: result: $ac_cv_kpthread" >&5
echo "${ECHO_T}$ac_cv_kpthread" >&6
fi
if test $ac_cv_kpthread = no
then
# -Kthread, if available, provides the right #defines
# and linker options to make pthread_create available
# Some compilers won't report that they do not support -Kthread,
# so we need to run a program to see whether it really made the
# function available.
echo "$as_me:$LINENO: checking whether $CC accepts -Kthread" >&5
echo $ECHO_N "checking whether $CC accepts -Kthread... $ECHO_C" >&6
if test "${ac_cv_kthread+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_save_cc="$CC"
CC="$CC -Kthread"
if test "$cross_compiling" = yes; then
ac_cv_kthread=no
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <pthread.h>
void* routine(void* p){return NULL;}
int main(){
pthread_t p;
if(pthread_create(&p,NULL,routine,NULL)!=0)
return 1;
(void)pthread_detach(p);
return 0;
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_kthread=yes
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_kthread=no
fi
rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
CC="$ac_save_cc"
fi
echo "$as_me:$LINENO: result: $ac_cv_kthread" >&5
echo "${ECHO_T}$ac_cv_kthread" >&6
fi
# checks for header files
echo "$as_me:$LINENO: checking for ANSI C header files" >&5
@ -9128,6 +9190,8 @@ _ACEOF
ac_save_cc="$CC"
if test "$ac_cv_kpthread" = "yes"
then CC="$CC -Kpthread"
elif test "$ac_cv_kthread" = "yes"
then CC="$CC -Kthread"
fi
echo "$as_me:$LINENO: checking for pthread_t" >&5
echo $ECHO_N "checking for pthread_t... $ECHO_C" >&6
@ -10135,6 +10199,15 @@ then
CC="$CC -Kpthread"
cat >>confdefs.h <<\_ACEOF
#define WITH_THREAD 1
_ACEOF
posix_threads=yes
THREADOBJ="Python/thread.o"
elif test "$ac_cv_kthread" = "yes"
then
CC="$CC -Kthread"
cat >>confdefs.h <<\_ACEOF
#define WITH_THREAD 1
_ACEOF
posix_threads=yes

View file

@ -752,6 +752,37 @@ CC="$ac_save_cc"])
AC_MSG_RESULT($ac_cv_kpthread)
fi
if test $ac_cv_kpthread = no
then
# -Kthread, if available, provides the right #defines
# and linker options to make pthread_create available
# Some compilers won't report that they do not support -Kthread,
# so we need to run a program to see whether it really made the
# function available.
AC_MSG_CHECKING(whether $CC accepts -Kthread)
AC_CACHE_VAL(ac_cv_kthread,
[ac_save_cc="$CC"
CC="$CC -Kthread"
AC_TRY_RUN([
#include <pthread.h>
void* routine(void* p){return NULL;}
int main(){
pthread_t p;
if(pthread_create(&p,NULL,routine,NULL)!=0)
return 1;
(void)pthread_detach(p);
return 0;
}
],
ac_cv_kthread=yes,
ac_cv_kthread=no,
ac_cv_kthread=no)
CC="$ac_save_cc"])
AC_MSG_RESULT($ac_cv_kthread)
fi
dnl # check for ANSI or K&R ("traditional") preprocessor
dnl AC_MSG_CHECKING(for C preprocessor type)
dnl AC_TRY_COMPILE([
@ -940,6 +971,8 @@ AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
ac_save_cc="$CC"
if test "$ac_cv_kpthread" = "yes"
then CC="$CC -Kpthread"
elif test "$ac_cv_kthread" = "yes"
then CC="$CC -Kthread"
fi
AC_MSG_CHECKING(for pthread_t)
have_pthread_t=no
@ -1367,6 +1400,12 @@ then
AC_DEFINE(WITH_THREAD)
posix_threads=yes
THREADOBJ="Python/thread.o"
elif test "$ac_cv_kthread" = "yes"
then
CC="$CC -Kthread"
AC_DEFINE(WITH_THREAD)
posix_threads=yes
THREADOBJ="Python/thread.o"
else
if test ! -z "$with_threads" -a -d "$with_threads"
then LDFLAGS="$LDFLAGS -L$with_threads"