RFR: 8351322: Parameterize link option for pthreads

Magnus Ihse Bursie ihse at openjdk.org
Thu Mar 6 15:51:52 UTC 2025


On Thu, 6 Mar 2025 14:21:08 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

> What is the intended way of using this? Do you run make with LIBPTHREAD=-pthread or do you apply a patch on libraries.m4 for the specific way of linking to pthread?

This is in preparation of the upcoming BSD port, which uses `-pthread` instead of `-pthread`. It was me who suggested that this is done separately with the existing code, to minimize the patch of the BSD port.

> make/autoconf/libraries.m4 line 142:
> 
>> 140:   # Threading library
>> 141:   if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xaix; then
>> 142:     BASIC_JVM_LIBS="$BASIC_JVM_LIBS $(LIBPTHREAD)"
> 
> If you specifically need this to be resolved in the makefile rather than here, then please add a comment explaining why, otherwise use a shell script variable reference.
> 
> Suggestion:
> 
>     BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBPTHREAD"

Yes, this is incorrect. Remember that m4 are shell scripts so you need to use shell syntax here. (I know it is confusing).

-------------

PR Comment: https://git.openjdk.org/jdk/pull/23930#issuecomment-2704233217
PR Review Comment: https://git.openjdk.org/jdk/pull/23930#discussion_r1983608153


More information about the build-dev mailing list