--- configure.in.~1.230.~ 2004-02-10 09:37:56.000000000 +1000 +++ configure.in 2004-02-16 10:32:42.000000000 +1000 @@ -914,12 +914,30 @@ case "$with_threads" in "yes" | "pthread" | "pthreads" | "pthread-threads" | "") + + # Note that gcc -pthread is vital on FreeBSD, there's no -lpthread + # normally used there, the threading stuff is in a special libc_r + # selected by gcc -pthread. + # + if test $GCC = yes; then + # try gcc -pthread + old_CFLAGS=$CFLAGS + CFLAGS="-pthread $CFLAGS" + AC_TRY_LINK([#include ], [pthread_yield();], + [SCM_I_GSC_USE_PTHREAD_THREADS=1 + with_threads="pthreads"], + [CFLAGS=$old_CFLAGS]) + fi + + if test "$SCM_I_GSC_USE_PTHREAD_THREADS" != 1; then + # otherwise try just -lpthread AC_CHECK_LIB(pthread, main, LIBS="-lpthread $LIBS" SCM_I_GSC_USE_PTHREAD_THREADS=1 with_threads="pthreads", with_threads="null") - + fi + if test $GCC = yes; then AC_DEFINE(_THREAD_SAFE, 1, [Use thread safe versions of GNU Libc functions.])