From: John Ericson Date: Tue, 9 Dec 2025 22:06:48 +0000 (+0000) Subject: Factor out thread model detection with new `GCC_AC_THREAD_MODEL` macro X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e5d853bbe9b05d6a00d98ad236f01937303e40c4;p=thirdparty%2Fgcc.git Factor out thread model detection with new `GCC_AC_THREAD_MODEL` macro This macro deduplicates the $CC -v 2>&1 | sed -n 's/^Thread model: //p' check that was occurring in various runtime libs. Additionally, as a bit of an Easter egg, this also allows overriding what the compiler would return by setting the `gcc_cv_target_thread_file` cache variable first. I admit that it is in fact this Easter egg that led me to write the patch. The use-case for it is for making multilib builds where the library sets do not all share the same thread model easier. See also `THREAD_MODEL_SPEC` for more about the varying thread models use-case. Arguably one could could try to define on `THREAD_MODEL_SPEC` on more platforms (besides e.g. AIX) but the ramifications of this are a bit unclear. Setting `gcc_cv_target_thread_file` directly is a "low tech" solution that will work for now for sure. Of course, since setting a cache variable like this a hacky trick, I will not expect this to be at all stable/guaranteed to work, going forward. Thanks to Arsen who on IRC discussed these things with me, including in particular making it a cache var not `--with-model` flag, to not prematurely foster expectations that this is stable. Suggested-by: Arsen Arsenović config/ChangeLog: * gthr.m4: Create new GCC_AC_THREAD_MODEL macro libatomic/ChangeLog: * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * configure.ac: Use GCC_AC_THREAD_MODEL instead of hand-rolled * testsuite/Makefile.in: Regenerate. libgcc/ChangeLog: * configure: Regenerate. * configure.ac: Use GCC_AC_THREAD_MODEL instead of hand-rolled libphobos/ChangeLog: * configure: Regenerate. * m4/druntime/os.m4: Use AC_MSG_ERROR, not private as_fn_error libstdc++-v3/ChangeLog: * acinclude.m4: Use GCC_AC_THREAD_MODEL instead, via AC_REQUIRE * configure: Regenerate. --- diff --git a/config/gthr.m4 b/config/gthr.m4 index 11996247f15..e8fac4a5721 100644 --- a/config/gthr.m4 +++ b/config/gthr.m4 @@ -5,6 +5,26 @@ dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. +dnl Define thread model + +dnl usage: GCC_AC_THREAD_MODEL +AC_DEFUN([GCC_AC_THREAD_MODEL], +[ +# Specify the threading model for this GCC runtime library +# Pass with no value to take from compiler's metadata +# Pass with a value to specify a thread package +# 'single' means single threaded -- without threads. +AC_CACHE_CHECK([for the threading model used by GCC], [gcc_cv_target_thread_file], [ + # Set new cache variable + gcc_cv_target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` +]) +# Set variable name (not prefixed enough to be a good cache variable +# name) traditionally used for this purpose, to avoid having to change +# a bunch of configure scripts. +target_thread_file="$gcc_cv_target_thread_file" +]) + + dnl Define header location by thread model dnl usage: GCC_AC_THREAD_HEADER([thread_model]) @@ -23,6 +43,9 @@ case $1 in vxworks) thread_header=config/gthr-vxworks.h ;; win32) thread_header=config/i386/gthr-win32.h ;; mcf) thread_header=config/i386/gthr-mcf.h ;; + *) + AC_MSG_ERROR([No known header for threading model '$1'.]) + ;; esac AC_SUBST(thread_header) ]) diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in index 95f9c72df58..c9e53e17a95 100644 --- a/libatomic/Makefile.in +++ b/libatomic/Makefile.in @@ -108,6 +108,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ $(top_srcdir)/../config/clang-plugin.m4 \ $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/gcc-plugin.m4 \ + $(top_srcdir)/../config/gthr.m4 \ $(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/lthostflags.m4 \ $(top_srcdir)/../config/multi.m4 \ @@ -171,7 +172,7 @@ libatomic_la_OBJECTS = $(am_libatomic_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent -am__v_lt_1 = +am__v_lt_1 = libatomic_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libatomic_la_LDFLAGS) $(LDFLAGS) -o $@ @@ -192,11 +193,11 @@ am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = +am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ -am__v_at_1 = +am__v_at_1 = depcomp = $(SHELL) $(top_srcdir)/../depcomp am__depfiles_maybe = depfiles am__mv = mv -f @@ -209,7 +210,7 @@ LTCPPASCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ AM_V_CPPAS = $(am__v_CPPAS_@AM_V@) am__v_CPPAS_ = $(am__v_CPPAS_@AM_DEFAULT_V@) am__v_CPPAS_0 = @echo " CPPAS " $@; -am__v_CPPAS_1 = +am__v_CPPAS_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -219,7 +220,7 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ @@ -227,7 +228,7 @@ LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = +am__v_CCLD_1 = SOURCES = $(libatomic_la_SOURCES) $(EXTRA_libatomic_la_SOURCES) \ $(libatomic_convenience_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ @@ -422,10 +423,10 @@ AM_CCASFLAGS = $(XCFLAGS) AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS) toolexeclib_LTLIBRARIES = libatomic.la noinst_LTLIBRARIES = libatomic_convenience.la -@LIBAT_BUILD_VERSIONED_SHLIB_FALSE@libatomic_version_script = +@LIBAT_BUILD_VERSIONED_SHLIB_FALSE@libatomic_version_script = @LIBAT_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_script = -Wl,--version-script,$(top_srcdir)/libatomic.map @LIBAT_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_script = -Wl,-M,libatomic.map-sun -@LIBAT_BUILD_VERSIONED_SHLIB_FALSE@libatomic_version_dep = +@LIBAT_BUILD_VERSIONED_SHLIB_FALSE@libatomic_version_dep = @LIBAT_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = $(top_srcdir)/libatomic.map @LIBAT_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = libatomic.map-sun libatomic_version_info = -version-info $(libtool_VERSION) @@ -443,7 +444,7 @@ libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \ @PARTIAL_VXWORKS_FALSE@SIZEOBJS = load store cas exch fadd fsub fand fior fxor fnand tas @PARTIAL_VXWORKS_FALSE@EXTRA_libatomic_la_SOURCES = $(addsuffix _n.c,$(SIZEOBJS)) @PARTIAL_VXWORKS_FALSE@libatomic_la_DEPENDENCIES = $(libatomic_la_LIBADD) $(libatomic_version_dep) -@PARTIAL_VXWORKS_FALSE@empty = +@PARTIAL_VXWORKS_FALSE@empty = @PARTIAL_VXWORKS_FALSE@space = $(empty) $(empty) @PARTIAL_VXWORKS_FALSE@PAT_SPLIT = $(subst _,$(space),$(*F)) @PARTIAL_VXWORKS_FALSE@PAT_BASE = $(word 1,$(PAT_SPLIT)) @@ -452,7 +453,7 @@ libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \ @PARTIAL_VXWORKS_FALSE@IFUNC_DEF = -DIFUNC_ALT=$(PAT_S) @PARTIAL_VXWORKS_FALSE@IFUNC_OPT = $(subst |,$(space),$(word $(PAT_S),$(IFUNC_OPTIONS))) @PARTIAL_VXWORKS_FALSE@@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo -@PARTIAL_VXWORKS_FALSE@@AMDEP_FALSE@M_DEPS = +@PARTIAL_VXWORKS_FALSE@@AMDEP_FALSE@M_DEPS = @PARTIAL_VXWORKS_FALSE@M_SIZE = -DN=$(PAT_N) @PARTIAL_VXWORKS_FALSE@M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT)) @PARTIAL_VXWORKS_FALSE@M_FILE = $(PAT_BASE)_n.c @@ -485,10 +486,10 @@ libatomic_convenience_la_LIBADD = $(libatomic_la_LIBADD) # built after libatomic, which makes RPATH insecure. Removing libatomic.la # from $gcc_objdir seems to fix the issue. gcc_objdir = `pwd`/$(MULTIBUILDTOP)../../gcc/ -MULTISRCTOP = -MULTIBUILDTOP = -MULTIDIRS = -MULTISUBDIR = +MULTISRCTOP = +MULTIBUILDTOP = +MULTIDIRS = +MULTISUBDIR = MULTIDO = true MULTICLEAN = true all: auto-config.h @@ -538,7 +539,7 @@ auto-config.h: stamp-h1 stamp-h1: $(srcdir)/auto-config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status auto-config.h -$(srcdir)/auto-config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(srcdir)/auto-config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ @@ -592,10 +593,10 @@ clean-toolexeclibLTLIBRARIES: rm -f $${locs}; \ } -libatomic.la: $(libatomic_la_OBJECTS) $(libatomic_la_DEPENDENCIES) $(EXTRA_libatomic_la_DEPENDENCIES) +libatomic.la: $(libatomic_la_OBJECTS) $(libatomic_la_DEPENDENCIES) $(EXTRA_libatomic_la_DEPENDENCIES) $(AM_V_CCLD)$(libatomic_la_LINK) -rpath $(toolexeclibdir) $(libatomic_la_OBJECTS) $(libatomic_la_LIBADD) $(LIBS) -libatomic_convenience.la: $(libatomic_convenience_la_OBJECTS) $(libatomic_convenience_la_DEPENDENCIES) $(EXTRA_libatomic_convenience_la_DEPENDENCIES) +libatomic_convenience.la: $(libatomic_convenience_la_OBJECTS) $(libatomic_convenience_la_DEPENDENCIES) $(EXTRA_libatomic_convenience_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libatomic_convenience_la_OBJECTS) $(libatomic_convenience_la_LIBADD) $(LIBS) mostlyclean-compile: diff --git a/libatomic/aclocal.m4 b/libatomic/aclocal.m4 index 91bff17e5ea..4d7c727d9d3 100644 --- a/libatomic/aclocal.m4 +++ b/libatomic/aclocal.m4 @@ -1191,6 +1191,7 @@ m4_include([../config/acx.m4]) m4_include([../config/clang-plugin.m4]) m4_include([../config/depstand.m4]) m4_include([../config/gcc-plugin.m4]) +m4_include([../config/gthr.m4]) m4_include([../config/lead-dot.m4]) m4_include([../config/lthostflags.m4]) m4_include([../config/multi.m4]) diff --git a/libatomic/configure b/libatomic/configure index dd0f0867356..a6db78e9078 100755 --- a/libatomic/configure +++ b/libatomic/configure @@ -12254,11 +12254,28 @@ libtool_VERSION=3:0:2 # Check for used threading-model -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread model used by GCC" >&5 -$as_echo_n "checking for thread model used by GCC... " >&6; } -target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $target_thread_file" >&5 -$as_echo "$target_thread_file" >&6; } + +# Specify the threading model for this GCC runtime library +# Pass with no value to take from compiler's metadata +# Pass with a value to specify a thread package +# 'single' means single threaded -- without threads. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the threading model used by GCC" >&5 +$as_echo_n "checking for the threading model used by GCC... " >&6; } +if ${gcc_cv_target_thread_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + + # Set new cache variable + gcc_cv_target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_target_thread_file" >&5 +$as_echo "$gcc_cv_target_thread_file" >&6; } +# Set variable name (not prefixed enough to be a good cache variable +# name) traditionally used for this purpose, to avoid having to change +# a bunch of configure scripts. +target_thread_file="$gcc_cv_target_thread_file" + case "$target" in *aarch64*) diff --git a/libatomic/configure.ac b/libatomic/configure.ac index 3da2f941974..62c2a6beada 100644 --- a/libatomic/configure.ac +++ b/libatomic/configure.ac @@ -177,9 +177,7 @@ libtool_VERSION=3:0:2 AC_SUBST(libtool_VERSION) # Check for used threading-model -AC_MSG_CHECKING([for thread model used by GCC]) -target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` -AC_MSG_RESULT([$target_thread_file]) +GCC_AC_THREAD_MODEL case "$target" in *aarch64*) diff --git a/libatomic/testsuite/Makefile.in b/libatomic/testsuite/Makefile.in index f540a752307..5d6872b0d92 100644 --- a/libatomic/testsuite/Makefile.in +++ b/libatomic/testsuite/Makefile.in @@ -94,6 +94,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ $(top_srcdir)/../config/clang-plugin.m4 \ $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/gcc-plugin.m4 \ + $(top_srcdir)/../config/gthr.m4 \ $(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/lthostflags.m4 \ $(top_srcdir)/../config/multi.m4 \ @@ -120,11 +121,11 @@ am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = +am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ -am__v_at_1 = +am__v_at_1 = SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ diff --git a/libgcc/configure b/libgcc/configure index d5e80d227ff..be5b5a91ece 100755 --- a/libgcc/configure +++ b/libgcc/configure @@ -5046,11 +5046,28 @@ $as_echo "$acl_cv_prog_gnu_ld" >&6; } with_gnu_ld=$acl_cv_prog_gnu_ld -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread model used by GCC" >&5 -$as_echo_n "checking for thread model used by GCC... " >&6; } -target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $target_thread_file" >&5 -$as_echo "$target_thread_file" >&6; } + +# Specify the threading model for this GCC runtime library +# Pass with no value to take from compiler's metadata +# Pass with a value to specify a thread package +# 'single' means single threaded -- without threads. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the threading model used by GCC" >&5 +$as_echo_n "checking for the threading model used by GCC... " >&6; } +if ${gcc_cv_target_thread_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + + # Set new cache variable + gcc_cv_target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_target_thread_file" >&5 +$as_echo "$gcc_cv_target_thread_file" >&6; } +# Set variable name (not prefixed enough to be a good cache variable +# name) traditionally used for this purpose, to avoid having to change +# a bunch of configure scripts. +target_thread_file="$gcc_cv_target_thread_file" + # Check for assembler CFI support. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether assembler supports CFI directives" >&5 @@ -5737,6 +5754,9 @@ case $target_thread_file in vxworks) thread_header=config/gthr-vxworks.h ;; win32) thread_header=config/i386/gthr-win32.h ;; mcf) thread_header=config/i386/gthr-mcf.h ;; + *) + as_fn_error $? "No known header for threading model '$target_thread_file'." "$LINENO" 5 + ;; esac diff --git a/libgcc/configure.ac b/libgcc/configure.ac index 65cd3c6aa1a..97fd17cddc6 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -305,9 +305,7 @@ AC_SUBST([use_tm_clone_registry]) AC_LIB_PROG_LD_GNU -AC_MSG_CHECKING([for thread model used by GCC]) -target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` -AC_MSG_RESULT([$target_thread_file]) +GCC_AC_THREAD_MODEL # Check for assembler CFI support. AC_CACHE_CHECK([whether assembler supports CFI directives], [libgcc_cv_cfi], diff --git a/libphobos/configure b/libphobos/configure index 1b540662073..3965e64e593 100755 --- a/libphobos/configure +++ b/libphobos/configure @@ -14920,7 +14920,7 @@ case $d_thread_model in # TODO: These targets need porting. dce|mipssde|rtems|tpf|vxworks) DCFG_THREAD_MODEL="Single" ;; - *) as_fn_error "Thread implementation '$d_thread_model' not recognised" "$LINENO" 5 ;; + *) as_fn_error $? "Thread implementation '$d_thread_model' not recognised" "$LINENO" 5 ;; esac diff --git a/libphobos/m4/druntime/os.m4 b/libphobos/m4/druntime/os.m4 index ef8ca434407..7bb91362dbe 100644 --- a/libphobos/m4/druntime/os.m4 +++ b/libphobos/m4/druntime/os.m4 @@ -32,7 +32,7 @@ case $1 in # TODO: These targets need porting. dce|mipssde|rtems|tpf|vxworks) DCFG_THREAD_MODEL="Single" ;; - *) as_fn_error "Thread implementation '$1' not recognised" "$LINENO" 5 ;; + *) AC_MSG_ERROR([Thread implementation '$1' not recognised]) ;; esac AC_SUBST(DCFG_THREAD_MODEL) ]) diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index e4eb773144a..103515c000f 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -4193,9 +4193,7 @@ dnl Substs: dnl thread_header dnl AC_DEFUN([GLIBCXX_ENABLE_THREADS], [ - AC_MSG_CHECKING([for thread model used by GCC]) - target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` - AC_MSG_RESULT([$target_thread_file]) + AC_REQUIRE([GCC_AC_THREAD_MODEL]) GCC_AC_THREAD_HEADER([$target_thread_file]) ]) @@ -4208,6 +4206,7 @@ dnl dnl GLIBCXX_ENABLE_SYMVERS must be done before this. dnl AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [ + AC_REQUIRE([GCC_AC_THREAD_MODEL]) GLIBCXX_ENABLE(libstdcxx-threads,auto,,[enable C++11 threads support]) if test x$enable_libstdcxx_threads = xauto || @@ -4220,7 +4219,6 @@ AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [ CXXFLAGS="$CXXFLAGS -fno-exceptions \ -I${toplevel_srcdir}/libgcc -I${toplevel_builddir}/libgcc" - target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` case $target_thread_file in posix) CXXFLAGS="$CXXFLAGS -DSUPPORTS_WEAK -DGTHREAD_USE_WEAK -D_PTHREADS" diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index b1e1275c47f..5f1f18c7e63 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -16330,11 +16330,29 @@ $as_echo "$enable_libstdcxx_pch" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread model used by GCC" >&5 -$as_echo_n "checking for thread model used by GCC... " >&6; } - target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $target_thread_file" >&5 -$as_echo "$target_thread_file" >&6; } +# Specify the threading model for this GCC runtime library +# Pass with no value to take from compiler's metadata +# Pass with a value to specify a thread package +# 'single' means single threaded -- without threads. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the threading model used by GCC" >&5 +$as_echo_n "checking for the threading model used by GCC... " >&6; } +if ${gcc_cv_target_thread_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + + # Set new cache variable + gcc_cv_target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_target_thread_file" >&5 +$as_echo "$gcc_cv_target_thread_file" >&6; } +# Set variable name (not prefixed enough to be a good cache variable +# name) traditionally used for this purpose, to avoid having to change +# a bunch of configure scripts. +target_thread_file="$gcc_cv_target_thread_file" + + + case $target_thread_file in aix) thread_header=config/rs6000/gthr-aix.h ;; @@ -16349,6 +16367,9 @@ case $target_thread_file in vxworks) thread_header=config/gthr-vxworks.h ;; win32) thread_header=config/i386/gthr-win32.h ;; mcf) thread_header=config/i386/gthr-mcf.h ;; + *) + as_fn_error $? "No known header for threading model '$target_thread_file'." "$LINENO" 5 + ;; esac @@ -16422,7 +16443,7 @@ $as_echo "$glibcxx_cv_atomic_word" >&6; } # Fake what AC_TRY_COMPILE does. cat > conftest.$ac_ext << EOF -#line 16425 "configure" +#line 16446 "configure" #include "${glibcxx_srcdir}/config/$atomic_word_dir/atomic_word.h" int main() { @@ -16568,7 +16589,7 @@ $as_echo "mutex" >&6; } # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 16571 "configure" +#line 16592 "configure" int main() { _Decimal32 d1; @@ -16610,7 +16631,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 16613 "configure" +#line 16634 "configure" template struct same { typedef T2 type; }; @@ -52252,6 +52273,7 @@ done # For gthread support. Depends on GLIBCXX_ENABLE_SYMVERS. + # Check whether --enable-libstdcxx-threads was given. if test "${enable_libstdcxx_threads+set}" = set; then : enableval=$enable_libstdcxx_threads; @@ -52281,7 +52303,6 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu CXXFLAGS="$CXXFLAGS -fno-exceptions \ -I${toplevel_srcdir}/libgcc -I${toplevel_builddir}/libgcc" - target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` case $target_thread_file in posix) CXXFLAGS="$CXXFLAGS -DSUPPORTS_WEAK -DGTHREAD_USE_WEAK -D_PTHREADS" @@ -53969,7 +53990,7 @@ $as_echo "$glibcxx_cv_libbacktrace_atomics" >&6; } CXXFLAGS='-O0 -S' cat > conftest.$ac_ext << EOF -#line 53972 "configure" +#line 53993 "configure" #include int main() {