git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] configure.ac: stronger test for pthread linkage
@ 2016-07-18 10:22 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-07-18 10:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

We need to test linkage of pthread_create and pthread_join,
as pthread_mutex_* and pthread_key_* functions do not need
extra linkage under FreeBSD 10.3, leading to a false-positive
of the empty case.

Signed-off-by: Eric Wong <e@80x24.org>
---
 configure.ac | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/configure.ac b/configure.ac
index c279025..aa9c91d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1108,14 +1108,19 @@ GIT_CONF_SUBST([HAVE_BSD_SYSCTL])
 AC_DEFUN([PTHREADTEST_SRC], [
 AC_LANG_PROGRAM([[
 #include <pthread.h>
+static void *noop(void *ignore) { return ignore; }
 ]], [[
 	pthread_mutex_t test_mutex;
 	pthread_key_t test_key;
+	pthread_t th;
 	int retcode = 0;
+	void *ret = (void *)0;
 	retcode |= pthread_key_create(&test_key, (void *)0);
 	retcode |= pthread_mutex_init(&test_mutex,(void *)0);
 	retcode |= pthread_mutex_lock(&test_mutex);
 	retcode |= pthread_mutex_unlock(&test_mutex);
+	retcode |= pthread_create(&th, ret, noop, ret);
+	retcode |= pthread_join(th, &ret);
 	return retcode;
 ]])])
 
-- 
EW

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-07-18 10:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-18 10:22 [PATCH] configure.ac: stronger test for pthread linkage Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).