]> Savannah Git Hosting - gnulib.git/commitdiff
threads-h: Fix link error on FreeBSD 11.
authorBruno Haible <bruno@clisp.org>
Fri, 21 Jun 2019 00:57:46 +0000 (02:57 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 21 Jun 2019 00:57:46 +0000 (02:57 +0200)
* m4/threads.m4 (gl_THREADS_H): When linking with -lstdthreads, link
also with -lpthread.

ChangeLog
m4/threads.m4

index 22cbc576721d0a62e20d29cad33c023389ce9499..c3180432bc4a8b763f13926d6da8234d02aa71ea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-06-20  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        threadlib: Fix typo (regression from today).
index 3cb3ae1d3f2ffb6ce08976d2fc6d78ffce3d99cf..3a921c0e33df3ab9de7917758eaf45a4f6c5f654 100644 (file)
@@ -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"