diff --git a/configure b/configure index 9b7c83fd1f..0e4e28d987 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Id: 381cb601a24a5cba9f1a5a52472d1c5e6b748a76 . +# From configure.ac Id: 542be6e5b6825d0cd20b4e8c48998a5bb613164e . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71. # @@ -18720,6 +18720,212 @@ printf "%s\n" "$ol_cv_pthread_create" >&6; } ol_link_pthreads="" fi + # Pthread try link: -mt (ol_cv_pthread_mt) +if test "$ol_link_threads" = no ; then + # try -mt + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread link with -mt" >&5 +printf %s "checking for pthread link with -mt... " >&6; } +if test ${ol_cv_pthread_mt+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + # save the flags + ol_LIBS="$LIBS" + LIBS="-mt $LIBS" + + if test "$cross_compiling" = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* pthread test headers */ +#include +#if HAVE_PTHREADS < 7 +#include +#endif +#ifndef NULL +#define NULL (void*)0 +#endif + +#ifdef __STDC__ +static void *task(void *p) +#else +static void *task(p) + void *p; +#endif +{ + return (void *) (p == NULL); +} + +int +main (void) +{ + + /* pthread test function */ +#ifndef PTHREAD_CREATE_DETACHED +#define PTHREAD_CREATE_DETACHED 1 +#endif + pthread_t t; + int status; + int detach = PTHREAD_CREATE_DETACHED; + +#if HAVE_PTHREADS > 4 + /* Final pthreads */ + pthread_attr_t attr; + + status = pthread_attr_init(&attr); + if( status ) return status; + +#if HAVE_PTHREADS < 7 + status = pthread_attr_setdetachstate(&attr, &detach); + if( status < 0 ) status = errno; +#else + status = pthread_attr_setdetachstate(&attr, detach); +#endif + if( status ) return status; + status = pthread_create( &t, &attr, task, NULL ); +#if HAVE_PTHREADS < 7 + if( status < 0 ) status = errno; +#endif + if( status ) return status; +#else + /* Draft 4 pthreads */ + status = pthread_create( &t, pthread_attr_default, task, NULL ); + if( status ) return errno; + + /* give thread a chance to complete */ + /* it should remain joinable and hence detachable */ + sleep( 1 ); + + status = pthread_detach( &t ); + if( status ) return errno; +#endif + +#ifdef HAVE_LINUX_THREADS + pthread_kill_other_threads_np(); +#endif + + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ol_cv_pthread_mt=yes +else $as_nop + ol_cv_pthread_mt=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* pthread test headers */ +#include +#if HAVE_PTHREADS < 7 +#include +#endif +#ifndef NULL +#define NULL (void*)0 +#endif + +#ifdef __STDC__ +static void *task(void *p) +#else +static void *task(p) + void *p; +#endif +{ + return (void *) (p == NULL); +} + + +#ifdef __STDC__ +int main(int argc, char **argv) +#else +int main(argc, argv) + int argc; + char **argv; +#endif +{ + + /* pthread test function */ +#ifndef PTHREAD_CREATE_DETACHED +#define PTHREAD_CREATE_DETACHED 1 +#endif + pthread_t t; + int status; + int detach = PTHREAD_CREATE_DETACHED; + +#if HAVE_PTHREADS > 4 + /* Final pthreads */ + pthread_attr_t attr; + + status = pthread_attr_init(&attr); + if( status ) return status; + +#if HAVE_PTHREADS < 7 + status = pthread_attr_setdetachstate(&attr, &detach); + if( status < 0 ) status = errno; +#else + status = pthread_attr_setdetachstate(&attr, detach); +#endif + if( status ) return status; + status = pthread_create( &t, &attr, task, NULL ); +#if HAVE_PTHREADS < 7 + if( status < 0 ) status = errno; +#endif + if( status ) return status; +#else + /* Draft 4 pthreads */ + status = pthread_create( &t, pthread_attr_default, task, NULL ); + if( status ) return errno; + + /* give thread a chance to complete */ + /* it should remain joinable and hence detachable */ + sleep( 1 ); + + status = pthread_detach( &t ); + if( status ) return errno; +#endif + +#ifdef HAVE_LINUX_THREADS + pthread_kill_other_threads_np(); +#endif + + return 0; + +} + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ol_cv_pthread_mt=yes +else $as_nop + ol_cv_pthread_mt=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + + # restore the LIBS + LIBS="$ol_LIBS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_mt" >&5 +printf "%s\n" "$ol_cv_pthread_mt" >&6; } + + if test $ol_cv_pthread_mt = yes ; then + ol_link_pthreads="-mt" + ol_link_threads=posix + fi +fi + # Pthread try link: -kthread (ol_cv_pthread_kthread) if test "$ol_link_threads" = no ; then # try -kthread