Solaris 2.6 and 2.7 need additional help to get thread support compiled in as
pthread_create is now defined in libc (it wasn't for 2.5.1).
If compiling with gcc, the following needs to appear before ./configure to
properly get thread support detected:
env ac_cv_func_pthread_create=no ol_cv_kthread_flag=no \
ol_cv_pthread_flag=no ol_cv_pthreads_flag=no \
ol_cv_thread_flag=no ./configure
If compiling with the Sun C compiler (tested with v5.0), only
ac_cv_func_pthread_create and ol_cv_kthread_flag need to be set to "no".
Because pthread_create is in libc for 2.6 and 2.7, configure will try to
locate pthread_create first in libc, then with the compiler flag "-kthread"
(which will fail with a compiler error causes cc to again locate
pthread_create in libc), then with the compiler flag "-pthread", then with
the compiler flag "-pthreads", and then with the compiler flag "-thread".
In all cases but the first, the compiler rejects the extra argument and tries
to link with libc (because we haven't yet tried linking with -pthread).
Here's how configure fails:
configure:3733: checking for pthread_create with -kthread
configure:3748: gcc -o conftest -O2 -I/opt/TWWfsw/libdb2/include \
-I/opt/TWWfsw/tcpwrap/include -L/opt/TWWfsw/libdb2/lib \
-L/opt/TWWfsw/tcpwrap/lib conftest.c -kthread -lresolv -lgen \
-lnsl -lsocket 1>&5
gcc: unrecognized option `-kthread'
(note: gcc flags may vary depending configure options selected and
specifics of your environment)
So, we help configure along by forcing it to jump straight to "-lpthread"
as shown in this configure output:
checking POSIX thread version... final
checking for LinuxThreads... no
checking for pthread_create... (cached) no
checking for pthread_create with -kthread... (cached) no
checking for pthread_create with -pthread... (cached) no
checking for pthread_create with -pthreads... (cached) no
checking for pthread_create with -thread... (cached) no
checking for pthread_create with -mt... (cached) no
checking for pthread_mutex_unlock in -lpthread... no
checking for pthread_mutex_lock in -lpthread... no
checking for pthread_mutex_trylock in -lpthread... no
checking for pthread_create in -lpthread... yes
|