From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3563 invoked by alias); 30 May 2019 11:34:02 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 3553 invoked by uid 89); 30 May 2019 11:34:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=afaict, AFAICT X-HELO: mail-wm1-f68.google.com Received: from mail-wm1-f68.google.com (HELO mail-wm1-f68.google.com) (209.85.128.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 May 2019 11:34:00 +0000 Received: by mail-wm1-f68.google.com with SMTP id z23so3608891wma.4 for ; Thu, 30 May 2019 04:34:00 -0700 (PDT) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:4eeb:42ff:feef:f164? ([2001:8a0:f913:f700:4eeb:42ff:feef:f164]) by smtp.gmail.com with ESMTPSA id v184sm4831244wma.6.2019.05.30.04.33.54 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Thu, 30 May 2019 04:33:55 -0700 (PDT) Subject: Re: [PATCH v3 3/8] Add configure check for std::thread To: Tom Tromey , gdb-patches@sourceware.org References: <20190529212916.23721-1-tom@tromey.com> <20190529212916.23721-4-tom@tromey.com> From: Pedro Alves Message-ID: <04acc58e-d293-1753-a106-15b94c5d5cbf@redhat.com> Date: Thu, 30 May 2019 11:34:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190529212916.23721-4-tom@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-05/txt/msg00681.txt.bz2 On 5/29/19 10:29 PM, Tom Tromey wrote: > This adds a configure check for std::thread. This is needed because > std::thread is not available in mingw. AFAICT, the patch actually does two things: - Add autoconf bits (ax_pthread.m4) to make sure we build with the right -pthread, -pthreads, -lpthread, -lpthreads, or whatever the right spelling is on the host to pull in the pthreads library. - Adds a configure check for std::thread, since it is not available on some platforms, at least out of the box. I think mingw-w64 (but not mingw.org) supports std::thread OOTB nowadays. I'd guess that DJGPP doesn't support it either, at least OOTB. Googling around seems to confirm that. Right? It'll be good to extend the commit log in that direction, IMO. On 5/29/19 10:29 PM, Tom Tromey wrote: > $(srcdir)/aclocal.m4: @MAINTAINER_MODE_TRUE@ $(aclocal_m4_deps) > cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) > diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 > index 0719d422a71..ff463ea3595 100644 > --- a/gdb/acinclude.m4 > +++ b/gdb/acinclude.m4 > @@ -76,6 +76,8 @@ m4_include(ptrace.m4) > > m4_include(ax_cxx_compile_stdcxx.m4) > > +sinclude([../config/ax_pthread.m4]) Is there reason to prefer sinclude over m4_include? I never got why we use sinclude so frequently, given it doesn't error out if the file doesn't exist. > --- a/gdb/common/common.m4 > +++ b/gdb/common/common.m4 > @@ -35,6 +35,31 @@ AC_DEFUN([GDB_AC_COMMON], [ > > AC_CHECK_DECLS([strerror, strstr]) > > + # Check for std::thread. This does not work on mingw. Maybe mention DJGPP too. > + AC_LANG_PUSH([C++]) > + AX_PTHREAD([threads=yes], [threads=no]) > + if test "$threads" = "yes"; then > + save_LIBS="$LIBS" > + LIBS="$PTHREAD_LIBS $LIBS" > + save_CXXFLAGS="$CXXFLAGS" > + CXXFLAGS="$PTHREAD_CFLAGS $save_CFLAGS" I think you meant save_CXXFLAGS here. Otherwise looks fine to me. Thanks, Pedro Alves