From b6293339816d7df16bb4d31d2ec1c1e5a79f976e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 21 Jun 2019 03:41:35 +0200 Subject: [PATCH] threads-h: Simplify link dependencies. * m4/threads.m4 (gl_THREADS_H): Bail out if Pth threading is requested. Don't set LTLIBSTDTHREAD. * modules/thrd (Link): Simplify accordingly. * modules/mtx (Link): Likewise. * modules/cnd (Link): Likewise. * modules/tss (Link): Likewise. * modules/threads (Link): Likewise. --- ChangeLog | 11 +++++++++++ m4/threads.m4 | 14 +++++++------- modules/cnd | 2 +- modules/mtx | 2 +- modules/thrd | 2 +- modules/threads | 2 +- modules/tss | 2 +- 7 files changed, 23 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index c3180432bc..7701108b77 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2019-06-20 Bruno Haible + + threads-h: Simplify link dependencies. + * m4/threads.m4 (gl_THREADS_H): Bail out if Pth threading is requested. + Don't set LTLIBSTDTHREAD. + * modules/thrd (Link): Simplify accordingly. + * modules/mtx (Link): Likewise. + * modules/cnd (Link): Likewise. + * modules/tss (Link): Likewise. + * modules/threads (Link): Likewise. + 2019-06-20 Bruno Haible threads-h: Fix link error on FreeBSD 11. diff --git a/m4/threads.m4 b/m4/threads.m4 index 3a921c0e33..87e97f3a0b 100644 --- a/m4/threads.m4 +++ b/m4/threads.m4 @@ -1,4 +1,4 @@ -# threads.m4 serial 2 +# threads.m4 serial 3 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, @@ -11,6 +11,12 @@ AC_DEFUN([gl_THREADS_H], AC_REQUIRE([gl_THREADLIB_BODY]) AC_REQUIRE([gl_YIELD]) + if test "$gl_use_threads" = pth; then + AC_MSG_ERROR([You cannot use --enable-threads=pth with the gnulib module 'threads-h'.]) + fi + dnl Now, since $gl_use_threads is not 'pth', $LTLIBMULTITHREAD and + dnl $LIBMULTITHREAD have the same value. Only system libraries are needed. + gl_CHECK_NEXT_HEADERS([threads.h]) if test $ac_cv_header_threads_h = yes; then HAVE_THREADS_H=1 @@ -47,7 +53,6 @@ AC_DEFUN([gl_THREADS_H], case "$host_os" in mingw*) LIBSTDTHREAD= - LTLIBSTDTHREAD= ;; *) if test $ac_cv_header_threads_h = yes; then @@ -58,26 +63,21 @@ AC_DEFUN([gl_THREADS_H], AC_CHECK_FUNCS([thrd_create]) if test $ac_cv_func_thrd_create = yes; then LIBSTDTHREAD= - LTLIBSTDTHREAD= else AC_CHECK_LIB([stdthreads], [thrd_create], [ LIBSTDTHREAD='-lstdthreads -lpthread' - LTLIBSTDTHREAD='-lstdthreads -lpthread' ], [ dnl Guess that thrd_create is in libpthread. LIBSTDTHREAD="$LIBMULTITHREAD" - LTLIBSTDTHREAD="$LTLIBMULTITHREAD" ]) fi else dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. LIBSTDTHREAD="$LIBMULTITHREAD $YIELD_LIB" - LTLIBSTDTHREAD="$LTLIBMULTITHREAD $YIELD_LIB" fi ;; esac AC_SUBST([LIBSTDTHREAD]) - AC_SUBST([LTLIBSTDTHREAD]) AH_VERBATIM([thread_local], [/* The _Thread_local keyword of C11. */ diff --git a/modules/cnd b/modules/cnd index 635a422487..6870479613 100644 --- a/modules/cnd +++ b/modules/cnd @@ -22,7 +22,7 @@ Include: Link: -$(LTLIBSTDTHREAD) when linking with libtool, $(LIBSTDTHREAD) otherwise +$(LIBSTDTHREAD) License: LGPLv2+ diff --git a/modules/mtx b/modules/mtx index a1d2a8ad4c..ade00b25eb 100644 --- a/modules/mtx +++ b/modules/mtx @@ -25,7 +25,7 @@ Include: Link: -$(LTLIBSTDTHREAD) when linking with libtool, $(LIBSTDTHREAD) otherwise +$(LIBSTDTHREAD) License: LGPLv2+ diff --git a/modules/thrd b/modules/thrd index 3fd606305d..388e0ea33b 100644 --- a/modules/thrd +++ b/modules/thrd @@ -24,7 +24,7 @@ Include: Link: -$(LTLIBSTDTHREAD) when linking with libtool, $(LIBSTDTHREAD) otherwise +$(LIBSTDTHREAD) License: LGPLv2+ diff --git a/modules/threads b/modules/threads index 2693bd5d30..18391c1c2d 100644 --- a/modules/threads +++ b/modules/threads @@ -18,7 +18,7 @@ Include: Link: -$(LTLIBSTDTHREAD) when linking with libtool, $(LIBSTDTHREAD) otherwise +$(LIBSTDTHREAD) License: LGPLv2+ diff --git a/modules/tss b/modules/tss index 4a28200d52..d751724842 100644 --- a/modules/tss +++ b/modules/tss @@ -21,7 +21,7 @@ Include: Link: -$(LTLIBSTDTHREAD) when linking with libtool, $(LIBSTDTHREAD) otherwise +$(LIBSTDTHREAD) License: LGPLv2+ -- 2.39.5