[PATCH v3 3/8] Add configure check for std::thread
Pedro Alves
palves@redhat.com
Thu May 30 11:34:00 GMT 2019
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
More information about the Gdb-patches
mailing list