Merge branch 'ew/autoconf-pthread'
authorJunio C Hamano <gitster@pobox.com>
Mon, 25 Jul 2016 21:13:46 +0000 (14:13 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Jul 2016 21:13:46 +0000 (14:13 -0700)
Existing autoconf generated test for the need to link with pthread
library did not check all the functions from pthread libraries;
recent FreeBSD has some functions in libc but not others, and we
mistakenly thought linking with libc is enough when it is not.

* ew/autoconf-pthread:
configure.ac: stronger test for pthread linkage

configure.ac
index c279025747349c19039b0e061954ae67b91b735a..aa9c91d20d86fad78c6e2f85d281ad417975a189 100644 (file)
@@ -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;
 ]])])