Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] Add autoconf tests for pthreads

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:45:35

david.syzdek@acsalaska.net writes:
+# Define PTHREAD_LIBS to the linker flag used for Pthread support and define
+# THREADED_DELTA_SEARCH if Pthreads are available.
This may affect platforms that do have pthread library but choose not to
use threaded delta search for whatever reason by suddenly turning it on.

Which arguably may be a good thing to do, but it is a change unrelated to
porting to FreeBSD.
+AC_LANG_CONFTEST([AC_LANG_PROGRAM(
+  [[#include <pthread.h>]],
+  [[pthread_mutex_t test_mutex;]]
+)])
+${CC} -pthread conftest.c -o conftest.o > /dev/null 2>&1
+if test $? -eq 0;then
+ PTHREAD_LIBS="-pthread"
+ THREADED_DELTA_SEARCH=YesPlease
+else
+ ${CC} -lpthread conftest.c -o conftest.o > /dev/null 2>&1
Maybe I am old fashioned, but having "-library" very near the beginning of
the command line and naming the final link product (i.e. not with -c) *.o
makes me go "Huh?"  If it were written like this,

	$CC -o conftest$ac_exeext conftest.c -lpthread

it might have been easier to swallow.  I dunno.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help