[X2Go-Commits] [nx-libs] 03/04: m4/ax_pthread.m4: implement workaround for libtool bug #13550.

git-admin at x2go.org git-admin at x2go.org
Thu Apr 4 11:34:14 CEST 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch bugfix/libXcomp-pthread-underlinking
in repository nx-libs.

commit 95f8cf7ea0a169b47c84be29d0db3a40d1a86d86
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Apr 4 11:06:05 2019 +0200

    m4/ax_pthread.m4: implement workaround for libtool bug #13550.
    
    Find the first available pthread library and use it together with the
    -pthread flag if the C compiler is set to GCC.
    
    Fixes: ArcticaProject/nx-libs#756
---
 m4/ax_pthread.m4 | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4
index 4920e07..07a9cd2 100644
--- a/m4/ax_pthread.m4
+++ b/m4/ax_pthread.m4
@@ -83,6 +83,7 @@
 #   exception to the GPL to apply to your modified version as well.
 
 #serial 25
+#arctica-serial 1
 
 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
 AC_DEFUN([AX_PTHREAD], [
@@ -334,6 +335,42 @@ for ax_pthread_try_flag in $ax_pthread_flags; do
                 PTHREAD_LIBS="-lpthread"
                 ;;
 
+                -pthread)
+                AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
+                PTHREAD_CFLAGS="$ax_pthread_try_flag"
+
+                if test "x$GCC" = "xyes"; then
+                        # Thanks to libtool bug #13550, we have to consider the possibility
+                        # that -nostdlib will be used during compilation at some point.
+                        # Try to determine the first pthread library available,
+                        # ignoring any other variants.
+                        for ax_pthread_try_lib_flag in $ax_pthread_flags; do
+                                case $ax_pthread_try_lib_flag in
+                                        none|-*|pthread-config)
+                                        continue
+                                        ;;
+
+                                        *)
+                                        PTHREAD_LIBS="-l$ax_pthread_try_lib_flag"
+
+                                        ax_pthread_save_LIBS="$LIBS"
+                                        LIBS="$PTHREAD_LIBS $LIBS"
+
+                                        # We only need to link a trivial program with
+                                        # the current library value.
+                                        # Linking should fail if the library doesn't
+                                        # exist, otherwise we should be good to go.
+                                        AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+                                            [LIBS="$ax_pthread_save_LIBS"
+                                             break],
+                                            [LIBS="$ax_pthread_save_LIBS"
+                                             PTHREAD_LIBS=""])
+                                        ;;
+                                esac
+                        done
+                fi
+                ;;
+
                 -*)
                 AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
                 PTHREAD_CFLAGS="$ax_pthread_try_flag"

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list