From: Petr Sumbera Date: Fri, 24 Jul 2026 13:34:18 +0000 (+0200) Subject: Fix pthread detection on Solaris 11.4 (#1479) X-Git-Tag: release-1.26.0rc1~2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=8a38bed2626ba064b0339d70dd343a5f96736ea6;p=thirdparty%2Funbound.git Fix pthread detection on Solaris 11.4 (#1479) AX_PTHREAD requires _REENTRANT to confirm that pthread support is enabled. Solaris 11.4 headers no longer use the macro, and GCC 16 therefore no longer defines it for -pthread. Detect XPG7 support in the target headers and require _REENTRANT only on older Solaris releases. The existing pthread compile and link test remains the final capability check. This follows the canonical Autoconf Archive change: https://github.com/autoconf-archive/autoconf-archive/pull/341 Regenerate configure with Autoconf 2.71. Tested on Solaris 11.4 with GCC 15.2 and GCC 16.1. The Autoconf Archive change was also tested on Solaris 11.3. Co-authored-by: Rainer Orth --- diff --git a/ax_pthread.m4 b/ax_pthread.m4 index 9f35d1391..a9019832e 100644 --- a/ax_pthread.m4 +++ b/ax_pthread.m4 @@ -87,7 +87,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 31 +#serial 32 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ @@ -249,7 +249,22 @@ AS_IF([test "x$ax_pthread_clang" = "xyes"], # correctly enabled case $host_os in - darwin* | hpux* | linux* | osf* | solaris*) + solaris*) + # Solaris 11.4 introduced XPG7 support and did away with the need for + # _REENTRANT. + + AC_EGREP_CPP([AX_PTHREAD_SOLARIS__REENTRANT], + [ +# undef _XOPEN_SOURCE +# include +# if _XOPEN_VERSION < 700 + AX_PTHREAD_SOLARIS__REENTRANT +# endif + ], + [ax_pthread_check_macro="_REENTRANT"], + [ax_pthread_check_macro="--"]) + ;; + darwin* | hpux* | linux* | osf*) ax_pthread_check_macro="_REENTRANT" ;; diff --git a/configure b/configure index 2f50d918a..7d9702d30 100755 --- a/configure +++ b/configure @@ -18415,7 +18415,31 @@ fi # correctly enabled case $host_os in - darwin* | hpux* | linux* | osf* | solaris*) + solaris*) + # Solaris 11.4 introduced XPG7 support and did away with the need for + # _REENTRANT. + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# undef _XOPEN_SOURCE +# include +# if _XOPEN_VERSION < 700 + AX_PTHREAD_SOLARIS__REENTRANT +# endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "AX_PTHREAD_SOLARIS__REENTRANT" >/dev/null 2>&1 +then : + ax_pthread_check_macro="_REENTRANT" +else $as_nop + ax_pthread_check_macro="--" +fi +rm -rf conftest* + + ;; + darwin* | hpux* | linux* | osf*) ax_pthread_check_macro="_REENTRANT" ;;