> 2019-12-01 Bruno Haible <[email protected]> > > pthread-h: Fix link errors with --enable-threads=isoc on AIX.
This patch was not entirely correct. With --enable-threads=isoc --with-c++-tests on AIX, I see a link error: xlC -q64 -qthreaded -qtls -L/home/haible/prefix64/lib -o test-pthread-c++ test-pthread-c++.o libtests.a ../gllib/libgnu.a libtests.a -lpthread ld: 0711-317 ERROR: Undefined symbol: rpl_pthread_rwlockattr_destroy ld: 0711-317 ERROR: Undefined symbol: rpl_pthread_rwlockattr_init ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. gmake[4]: *** [test-pthread-c++] Error 8 The attached two patches fix it. 2019-12-02 Bruno Haible <[email protected]> Fix some more link errors with --enable-threads=isoc. * modules/pthread-mutex (Depends-on): Test $gl_threads_api differently. * modules/pthread-rwlock (Depends-on): Likewise. 2019-12-02 Bruno Haible <[email protected]> Fix mistakes in --enable-threads=isoc fixes from 2019-12-01. * m4/pthread-mutex.m4 (gl_PTHREAD_MUTEX): Use LIBPMULTITHREAD, not LIBMULTITHREAD. * m4/pthread-rwlock.m4 (gl_PTHREAD_RWLOCK): Likewise. * m4/pthread-thread.m4 (gl_PTHREAD_THREAD): Likewise. * m4/timer_time.m4 (gl_TIMER_TIME): Likewise. Require gl_PTHREADLIB, not gl_THREADLIB. * modules/timer-time (Depends-on): Add pthread-h. Remove threadlib.
>From 9b2dcfaf45493f1527ea8d01f7634407de750978 Mon Sep 17 00:00:00 2001 From: Bruno Haible <[email protected]> Date: Tue, 3 Dec 2019 03:49:30 +0100 Subject: [PATCH 1/3] Fix some more link errors with --enable-threads=isoc. * modules/pthread-mutex (Depends-on): Test $gl_threads_api differently. * modules/pthread-rwlock (Depends-on): Likewise. --- ChangeLog | 6 ++++++ modules/pthread-mutex | 2 +- modules/pthread-rwlock | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 159f32c..7fc89a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2019-12-02 Bruno Haible <[email protected]> + Fix some more link errors with --enable-threads=isoc. + * modules/pthread-mutex (Depends-on): Test $gl_threads_api differently. + * modules/pthread-rwlock (Depends-on): Likewise. + +2019-12-02 Bruno Haible <[email protected]> + Fix link errors with --enable-threads=posix on AIX. * modules/string-c++-tests (Makefile.am): Link the test-string-c++ program with $(LIBTHREAD). diff --git a/modules/pthread-mutex b/modules/pthread-mutex index 556ffa8..9fdd2fe 100644 --- a/modules/pthread-mutex +++ b/modules/pthread-mutex @@ -7,7 +7,7 @@ m4/pthread-mutex.m4 Depends-on: pthread-h -pthread_mutex_timedlock [test $gl_threads_api = posix] +pthread_mutex_timedlock [test $gl_threads_api != windows] windows-timedmutex [test $gl_threads_api = windows] windows-timedrecmutex [test $gl_threads_api = windows] diff --git a/modules/pthread-rwlock b/modules/pthread-rwlock index e935414..4944edd 100644 --- a/modules/pthread-rwlock +++ b/modules/pthread-rwlock @@ -7,8 +7,8 @@ m4/pthread-rwlock.m4 Depends-on: pthread-h -pthread-cond [test $gl_threads_api = posix && test $REPLACE_PTHREAD_RWLOCK_INIT = 1] -nanosleep [test $gl_threads_api = posix && test $HAVE_PTHREAD_RWLOCK_INIT = 1 && test $HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK = 0] +pthread-cond [test $gl_threads_api != windows && test $REPLACE_PTHREAD_RWLOCK_INIT = 1] +nanosleep [test $gl_threads_api != windows && test $HAVE_PTHREAD_RWLOCK_INIT = 1 && test $HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK = 0] windows-timedrwlock [test $gl_threads_api = windows] configure.ac: -- 2.7.4
>From af16e1b401433476796c3bab5245c0a679c4dd26 Mon Sep 17 00:00:00 2001 From: Bruno Haible <[email protected]> Date: Tue, 3 Dec 2019 04:54:53 +0100 Subject: [PATCH 2/3] Fix mistakes in --enable-threads=isoc fixes from 2019-12-01. * m4/pthread-mutex.m4 (gl_PTHREAD_MUTEX): Use LIBPMULTITHREAD, not LIBMULTITHREAD. * m4/pthread-rwlock.m4 (gl_PTHREAD_RWLOCK): Likewise. * m4/pthread-thread.m4 (gl_PTHREAD_THREAD): Likewise. * m4/timer_time.m4 (gl_TIMER_TIME): Likewise. Require gl_PTHREADLIB, not gl_THREADLIB. * modules/timer-time (Depends-on): Add pthread-h. Remove threadlib. --- ChangeLog | 11 +++++++++++ m4/pthread-mutex.m4 | 4 ++-- m4/pthread-rwlock.m4 | 4 ++-- m4/pthread-thread.m4 | 4 ++-- m4/timer_time.m4 | 8 ++++---- modules/timer-time | 2 +- 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7fc89a6..b441ffd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2019-12-02 Bruno Haible <[email protected]> + Fix mistakes in --enable-threads=isoc fixes from 2019-12-01. + * m4/pthread-mutex.m4 (gl_PTHREAD_MUTEX): Use LIBPMULTITHREAD, not + LIBMULTITHREAD. + * m4/pthread-rwlock.m4 (gl_PTHREAD_RWLOCK): Likewise. + * m4/pthread-thread.m4 (gl_PTHREAD_THREAD): Likewise. + * m4/timer_time.m4 (gl_TIMER_TIME): Likewise. Require gl_PTHREADLIB, not + gl_THREADLIB. + * modules/timer-time (Depends-on): Add pthread-h. Remove threadlib. + +2019-12-02 Bruno Haible <[email protected]> + Fix some more link errors with --enable-threads=isoc. * modules/pthread-mutex (Depends-on): Test $gl_threads_api differently. * modules/pthread-rwlock (Depends-on): Likewise. diff --git a/m4/pthread-mutex.m4 b/m4/pthread-mutex.m4 index abe5f2f..044fa68 100644 --- a/m4/pthread-mutex.m4 +++ b/m4/pthread-mutex.m4 @@ -1,4 +1,4 @@ -# pthread-mutex.m4 serial 2 +# pthread-mutex.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, @@ -43,7 +43,7 @@ AC_DEFUN([gl_PTHREAD_MUTEX], AC_CACHE_CHECK([for pthread_mutexattr_getrobust], [gl_cv_func_pthread_mutexattr_getrobust], [saved_LIBS="$LIBS" - LIBS="$LIBS $LIBMULTITHREAD" + LIBS="$LIBS $LIBPMULTITHREAD" AC_LINK_IFELSE( [AC_LANG_SOURCE( [[extern diff --git a/m4/pthread-rwlock.m4 b/m4/pthread-rwlock.m4 index ee5953c..32bca6a 100644 --- a/m4/pthread-rwlock.m4 +++ b/m4/pthread-rwlock.m4 @@ -1,4 +1,4 @@ -# pthread-rwlock.m4 serial 1 +# pthread-rwlock.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, @@ -43,7 +43,7 @@ AC_DEFUN([gl_PTHREAD_RWLOCK], AC_CACHE_CHECK([for pthread_rwlock_init], [gl_cv_func_pthread_rwlock_init], [saved_LIBS="$LIBS" - LIBS="$LIBS $LIBMULTITHREAD" + LIBS="$LIBS $LIBPMULTITHREAD" AC_LINK_IFELSE( [AC_LANG_SOURCE( [[extern diff --git a/m4/pthread-thread.m4 b/m4/pthread-thread.m4 index eef29c9..e274d11 100644 --- a/m4/pthread-thread.m4 +++ b/m4/pthread-thread.m4 @@ -1,4 +1,4 @@ -# pthread-thread.m4 serial 1 +# pthread-thread.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, @@ -41,7 +41,7 @@ AC_DEFUN([gl_PTHREAD_THREAD], AC_CACHE_CHECK([whether pthread_create exists as a global function], [gl_cv_func_pthread_create], [saved_LIBS="$LIBS" - LIBS="$LIBS $LIBMULTITHREAD" + LIBS="$LIBS $LIBPMULTITHREAD" AC_LINK_IFELSE( [AC_LANG_SOURCE( [[extern diff --git a/m4/timer_time.m4 b/m4/timer_time.m4 index 2c9b93c..347d04d 100644 --- a/m4/timer_time.m4 +++ b/m4/timer_time.m4 @@ -1,4 +1,4 @@ -# timer_time.m4 serial 3 +# timer_time.m4 serial 4 dnl Copyright (C) 2011-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, @@ -16,7 +16,7 @@ AC_DEFUN([gl_TIMER_TIME], dnl Some packages like Emacs use --avoid=threadlib. dnl Write the symbol in such a way that it does not cause 'aclocal' to pick dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/. - m4_ifdef([gl_][THREADLIB], [AC_REQUIRE([gl_][THREADLIB])]) + m4_ifdef([gl_][PTHREADLIB], [AC_REQUIRE([gl_][PTHREADLIB])]) LIB_TIMER_TIME= AC_SUBST([LIB_TIMER_TIME]) @@ -24,7 +24,7 @@ AC_DEFUN([gl_TIMER_TIME], AC_SEARCH_LIBS([timer_settime], [rt posix4], [test "$ac_cv_search_timer_settime" = "none required" || LIB_TIMER_TIME=$ac_cv_search_timer_settime]) - m4_ifdef([gl_][THREADLIB], + m4_ifdef([gl_][PTHREADLIB], [dnl GLIBC uses threads to emulate posix timers when kernel support dnl is not available (like Linux < 2.6 or when used with kFreeBSD) dnl Now the pthread lib is linked automatically in the normal case, @@ -38,7 +38,7 @@ AC_DEFUN([gl_TIMER_TIME], #endif #endif ], - [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"])]) + [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBPMULTITHREAD"])]) AC_CHECK_FUNCS([timer_settime]) LIBS=$gl_saved_libs ]) diff --git a/modules/timer-time b/modules/timer-time index e3668c8..7f496d7 100644 --- a/modules/timer-time +++ b/modules/timer-time @@ -7,7 +7,7 @@ m4/timer_time.m4 Depends-on: extensions -threadlib +pthread-h configure.ac: gl_TIMER_TIME -- 2.7.4
