+ LTHREAD_LIBS="$LTHREAD_LIBS -lc_r"],:)
+ LIBS="$save_LIBS"
+ fi
+
+ if test $ol_link_threads = no ; then
+ dnl try -lpthreads
+ save_LIBS="$LIBS"
+ AC_CHECK_LIB(pthreads, pthread_create, [
+ ol_link_threads=posix
+ LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads"],:)
+ LIBS="$save_LIBS"
+ fi
+
+ dnl IRIX Pthread check
+ if test $ol_link_threads = no ; then
+ dnl try IRIX Pthreads -Wl,-woff,85 -lpthreads
+ save_LIBS="$LIBS"
+ AC_CHECK_LIB(pthreads, pthread_join, [
+ ol_link_threads=posix
+ LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads"
+ ],:,[-Wl,-woff,85])
+ LIBS="$save_LIBS"
+ fi
+
+ if test $ol_link_threads = no ; then
+ dnl try -threads
+ AC_CACHE_CHECK([for pthread_create with -threads],
+ [ol_cv_thread_flag], [
+ dnl save the flags
+ save_LIBS="$LIBS"
+ LIBS="-threads $LIBS"
+ AC_TRY_LINK([char pthread_create();],[
+ pthread_create();
+ ], ol_cv_thread_flag=yes, ol_cv_thread_flag=no)
+ dnl restore the LIBS
+ LIBS="$save_LIBS"
+ ])
+
+ if test $ol_cv_thread_flag = yes ; then
+ LTHREAD_LIBS="$LTHREAD_LIBS -threads"
+ ol_link_threads=posix
+ fi
+ fi
+
+ if test $ol_link_threads = no ; then
+ dnl try DEC Threads -lpthreads -lmach -lexc -lc_r
+ save_LIBS="$LIBS"
+ AC_CHECK_LIB(pthreads, pthread_mutex_unlock, [
+ ol_link_threads=posix
+ LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lmach -lexc -lc_r"
+ if test $ol_with_yielding_select = auto ; then
+ ol_with_yielding_select=yes
+ fi
+ ],:,[-lmach -lexc -lc_r])
+ LIBS="$save_LIBS"
+ fi
+
+ if test $ol_link_threads = no ; then
+ dnl try DEC Threads -lpthreads -lmach -lexc
+ save_LIBS="$LIBS"
+ AC_CHECK_LIB(pthreads, pthread_mutex_lock, [
+ ol_link_threads=posix
+ LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lmach -lexc"
+ if test $ol_with_yielding_select = auto ; then
+ ol_with_yielding_select=yes
+ fi
+ ],:,[-lmach -lexc])
+ LIBS="$save_LIBS"
+ fi
+
+ if test $ol_link_threads = no ; then
+ dnl try DEC Threads -lpthreads -lexc
+ save_LIBS="$LIBS"
+ AC_CHECK_LIB(pthreads, pthread_mutex_trylock, [
+ ol_link_threads=posix
+ LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lexc"
+ if test $ol_with_yielding_select = auto ; then
+ ol_with_yielding_select=yes
+ fi
+ ],:,[-lexc])