summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@libertysurf.fr>2012-10-22 07:32:02 +0000
committerEric Botcazou <ebotcazou@libertysurf.fr>2012-10-22 07:32:02 +0000
commit21089810442fb7d42fdfc0b557591fc8a0e1a520 (patch)
treeb5a420269fdb1d884998c2c596eda6a70d87e65f /configure.ac
parent928c07d77a5e1f2d12cb8bb7667bd77399112def (diff)
downloadbinutils-redhat-21089810442fb7d42fdfc0b557591fc8a0e1a520.tar.gz
PR bootstrap/54820
* Makefile.tpl (STAGE1_FLAGS_TO_PASS): New variable. (all-[+prefix+][+module+]): Pass stage1_args to sub-makes. (all-stage[+id+]-[+prefix+][+module+]): Likewise, if prev is false. (clean-stage[+id+]-[+prefix+][+module+]): Likewise, if prev is false. (host_modules): Set stage1_args to STAGE1_FLAGS_TO_PASS. * Makefile.in: Regenerate. * configure.ac (have_static_libs): New variable and associated check. (stage1-ldflags): Move to after stage1_libs and set to -static-libstdc++ -static-libgcc if stage1_libs is empty and have_static_libs is yes. * configure: Regenerate.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac44
1 files changed, 33 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac
index f0d86d9069..958eadd5e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1182,6 +1182,22 @@ if test -z "$LD"; then
fi
fi
+# Check whether -static-libstdc++ -static-libgcc is supported.
+have_static_libs=no
+if test "$GCC" = yes; then
+ saved_LDFLAGS="$LDFLAGS"
+
+ LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc"
+ AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc])
+ AC_LANG_PUSH(C++)
+ AC_LINK_IFELSE([int main() {}],
+ [AC_MSG_RESULT([yes]); have_static_libs=yes],
+ [AC_MSG_RESULT([no])])
+ AC_LANG_POP(C++)
+
+ LDFLAGS="$saved_LDFLAGS"
+fi
+
ACX_PROG_GNAT
ACX_PROG_CMP_IGNORE_INITIAL
@@ -1478,17 +1494,6 @@ case $with_host_libstdcxx in
;;
esac
-# Linker flags to use for stage1 or when not boostrapping.
-AC_ARG_WITH(stage1-ldflags,
-[AS_HELP_STRING([--with-stage1-ldflags=FLAGS], [linker flags for stage1])],
-[if test "$withval" = "no" -o "$withval" = "yes"; then
- stage1_ldflags=
- else
- stage1_ldflags=$withval
- fi],
-[stage1_ldflags=])
-AC_SUBST(stage1_ldflags)
-
# Libraries to use for stage1 or when not bootstrapping.
AC_ARG_WITH(stage1-libs,
[AS_HELP_STRING([--with-stage1-libs=LIBS], [libraries for stage1])],
@@ -1500,6 +1505,23 @@ AC_ARG_WITH(stage1-libs,
[stage1_libs=$with_host_libstdcxx])
AC_SUBST(stage1_libs)
+# Linker flags to use for stage1 or when not bootstrapping.
+AC_ARG_WITH(stage1-ldflags,
+[AS_HELP_STRING([--with-stage1-ldflags=FLAGS], [linker flags for stage1])],
+[if test "$withval" = "no" -o "$withval" = "yes"; then
+ stage1_ldflags=
+ else
+ stage1_ldflags=$withval
+ fi],
+[stage1_ldflags=
+ # In stage 1, default to linking libstdc++ and libgcc statically with GCC
+ # if supported. But if the user explicitly specified the libraries to use,
+ # trust that they are doing what they want.
+ if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then
+ stage1_ldflags="-static-libstdc++ -static-libgcc"
+ fi])
+AC_SUBST(stage1_ldflags)
+
# Libraries to use for stage2 and later builds. This defaults to the
# argument passed to --with-host-libstdcxx.
AC_ARG_WITH(boot-libs,