From 9e6e4c0336c9d03b109bcdb11f287eddcf376a87 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 21 Jun 2019 02:57:46 +0200 Subject: [PATCH] threads-h: Fix link error on FreeBSD 11. * m4/threads.m4 (gl_THREADS_H): When linking with -lstdthreads, link also with -lpthread. --- ChangeLog | 6 ++++++ m4/threads.m4 | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22cbc57672..c3180432bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2019-06-20 Bruno Haible + + threads-h: Fix link error on FreeBSD 11. + * m4/threads.m4 (gl_THREADS_H): When linking with -lstdthreads, link + also with -lpthread. + 2019-06-20 Bruno Haible threadlib: Fix typo (regression from today). diff --git a/m4/threads.m4 b/m4/threads.m4 index 3cb3ae1d3f..3a921c0e33 100644 --- a/m4/threads.m4 +++ b/m4/threads.m4 @@ -1,4 +1,4 @@ -# threads.m4 serial 1 +# threads.m4 serial 2 dnl Copyright (C) 2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -52,7 +52,8 @@ AC_DEFUN([gl_THREADS_H], *) if test $ac_cv_header_threads_h = yes; then dnl glibc >= 2.29 has thrd_create in libpthread. - dnl FreeBSD >= 10 has thrd_create in libstdthreads. + dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends + dnl on libpthread (for the symbol 'pthread_mutexattr_gettype'). dnl AIX >= 7.1 and Solaris >= 11.4 have thrd_create in libc. AC_CHECK_FUNCS([thrd_create]) if test $ac_cv_func_thrd_create = yes; then @@ -60,8 +61,8 @@ AC_DEFUN([gl_THREADS_H], LTLIBSTDTHREAD= else AC_CHECK_LIB([stdthreads], [thrd_create], [ - LIBSTDTHREAD='-lstdthreads' - LTLIBSTDTHREAD='-lstdthreads' + LIBSTDTHREAD='-lstdthreads -lpthread' + LTLIBSTDTHREAD='-lstdthreads -lpthread' ], [ dnl Guess that thrd_create is in libpthread. LIBSTDTHREAD="$LIBMULTITHREAD" -- 2.39.5