gcc/config.in | 6 ++++++
gcc/configure | 38 +++++++++++++++++++++++++++++++++++---
gcc/configure.ac | 26 +++++++++++++++++++++++++-
3 files changed, 66 insertions(+), 4 deletions(-)
@@ -1102,6 +1102,31 @@ AC_ARG_WITH(multilib-list,
:,
with_multilib_list=default)
+# If libatomic is available, whether it should be linked automatically
+AC_ARG_ENABLE(autolink-libatomic,
+[AS_HELP_STRING([--enable-autolink-libatomic],
+ [enable or disable the automatic linking of libatomic
+ if it is available (enabled by default)])],
+[
+ case $enable_autolink_libatomic in
+ yes | no) ;;
+ *) AC_MSG_ERROR(['$enable_autolink_libatomic' is an invalid value for
+--enable-autolink-libatomic. Valid choices are 'yes' and 'no'.]) ;;
+ esac
+], [enable_autolink_libatomic=''])
+
+if test x$enable_autolink_libatomic != xno; then
+ if echo " ${TARGET_CONFIGDIRS} " | grep " libatomic " > /dev/null 2>&1 ; then
+ AC_DEFINE(ENABLE_AUTOLINK_LIBATOMIC, 1,
+ [Define if libatomic should always be linked.])
+ else
+ if test x$enable_autolink_libatomic = xyes; then
+ AC_MSG_WARN([libatomic is not build for this target, --enable-autolink-libatomic ignored])
+ fi
+ fi
+fi
+
+
# -------------------------
# Checks for other programs
# -------------------------
@@ -7106,4 +7131,3 @@ done
],
[subdirs='$subdirs'])
AC_OUTPUT
-
@@ -106,6 +106,12 @@
#endif
+/* Define if libatomic should always be linked. */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_AUTOLINK_LIBATOMIC
+#endif
+
+
/* Define to 1 to specify that we are using the BID decimal floating point
format instead of DPD */
#ifndef USED_FOR_TARGET
@@ -972,6 +972,7 @@ with_documentation_root_url
with_changes_root_url
enable_languages
with_multilib_list
+enable_autolink_libatomic
with_zstd
with_zstd_include
with_zstd_lib
@@ -1698,6 +1699,9 @@ Optional Features:
--disable-shared don't provide a shared libgcc
--disable-gcov don't provide libgcov and related host tools
--enable-languages=LIST specify which front-ends to build
+ --enable-autolink-libatomic
+ enable or disable the automatic linking of libatomic
+ if it is available (enabled by default)
--disable-rpath do not hardcode runtime library paths
--enable-sjlj-exceptions
arrange to use setjmp/longjmp exception handling
@@ -8002,6 +8006,35 @@ else
fi
+# If libatomic is available, whether it should be linked automatically
+# Check whether --enable-autolink-libatomic was given.
+if test "${enable_autolink_libatomic+set}" = set; then :
+ enableval=$enable_autolink_libatomic;
+ case $enable_autolink_libatomic in
+ yes | no) ;;
+ *) as_fn_error $? "'$enable_autolink_libatomic' is an invalid value for
+--enable-autolink-libatomic. Valid choices are 'yes' and 'no'." "$LINENO" 5 ;;
+ esac
+
+else
+ enable_autolink_libatomic=''
+fi
+
+
+if test x$enable_autolink_libatomic != xno; then
+ if echo " ${TARGET_CONFIGDIRS} " | grep " libatomic " > /dev/null 2>&1 ; then
+
+$as_echo "#define ENABLE_AUTOLINK_LIBATOMIC 1" >>confdefs.h
+
+ else
+ if test x$enable_autolink_libatomic = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libatomic is not build for this target, --enable-autolink-libatomic ignored" >&5
+$as_echo "$as_me: WARNING: libatomic is not build for this target, --enable-autolink-libatomic ignored" >&2;}
+ fi
+ fi
+fi
+
+
# -------------------------
# Checks for other programs
# -------------------------
@@ -19018,7 +19051,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19021 "configure"
+#line 19054 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19124,7 +19157,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19127 "configure"
+#line 19160 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -32715,4 +32748,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
-