Skip to content

Commit cc985b1

Browse files
committed
threads: Fix C++/Fortran pthread tests
Commit 38e53f3 introduced a bug in the checks for pthreads when using C++ or Fortran, resulting in -pthread not being added to the wrapper compiler flags. This (on some platforms) lead to link errors in multi-threaded applications. Fix the bug by not declaring success after the check for whether or not pthreads works without additional libraries; this was overriding the value set in the plain check. Signed-off-by: Brian Barrett <bbarrett@amazon.com>
1 parent c747a1b commit cc985b1

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

opal/mca/threads/pthreads/configure.m4

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -353,13 +353,11 @@ AC_DEFUN([OPAL_INTL_POSIX_THREADS_PLAIN], [
353353
OPAL_INTL_POSIX_THREADS_PLAIN_C
354354
355355
AS_IF([test "$CXX" != "no"],
356-
[OPAL_INTL_POSIX_THREADS_PLAIN_CXX
357-
opal_pthread_cxx_success=1],
356+
[OPAL_INTL_POSIX_THREADS_PLAIN_CXX],
358357
[opal_pthread_cxx_success=0])
359358
360359
AS_IF([test "$FC" != "no"],
361-
[OPAL_INTL_POSIX_THREADS_PLAIN_FC
362-
opal_pthread_fortran_success=1],
360+
[OPAL_INTL_POSIX_THREADS_PLAIN_FC],
363361
[opal_pthread_fortran_success=0])
364362
365363
# End: OPAL_INTL_POSIX_THREADS_PLAIN
@@ -483,13 +481,11 @@ esac
483481
OPAL_INTL_POSIX_THREADS_SPECIAL_FLAGS_C
484482
485483
AS_IF([test "$CXX" != "no"],
486-
[OPAL_INTL_POSIX_THREADS_SPECIAL_FLAGS_CXX
487-
opal_pthread_cxx_success=1],
484+
[OPAL_INTL_POSIX_THREADS_SPECIAL_FLAGS_CXX],
488485
[opal_pthread_cxx_success=0])
489486
490487
AS_IF([test "$FC" != "no"],
491-
[OPAL_INTL_POSIX_THREADS_SPECIAL_FLAGS_FC
492-
opal_pthread_fortran_success=1],
488+
[OPAL_INTL_POSIX_THREADS_SPECIAL_FLAGS_FC],
493489
[opal_pthread_fortran_success=0])
494490
495491
OPAL_VAR_SCOPE_POP
@@ -675,13 +671,11 @@ plibs="-lpthreads -llthread -lpthread"
675671
OPAL_INTL_POSIX_THREADS_LIBS_C
676672
677673
AS_IF([test "$CXX" != "no"],
678-
[OPAL_INTL_POSIX_THREADS_LIBS_CXX
679-
opal_pthread_cxx_success=1],
674+
[OPAL_INTL_POSIX_THREADS_LIBS_CXX],
680675
[opal_pthread_cxx_success=0])
681676
682677
AS_IF([test "$FC" != "no"],
683-
[OPAL_INTL_POSIX_THREADS_LIBS_FC
684-
opal_pthread_fortran_success=1],
678+
[OPAL_INTL_POSIX_THREADS_LIBS_FC],
685679
[opal_pthread_fortran_success=0])
686680
687681
OPAL_VAR_SCOPE_POP

0 commit comments

Comments
 (0)